Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
OutputScopeManager.cs
Go to the documentation of this file.
1namespace System.Xml.Xsl.Xslt;
2
3internal sealed class OutputScopeManager
4{
5 public struct ScopeReord
6 {
7 public int scopeCount;
8
9 public string prefix;
10
11 public string nsUri;
12 }
13
14 private ScopeReord[] _records = new ScopeReord[32];
15
16 private int _lastRecord;
17
18 private int _lastScopes;
19
21 {
22 Reset();
23 }
24
25 public void Reset()
26 {
27 _records[0].prefix = null;
28 _records[0].nsUri = null;
29 PushScope();
30 }
31
32 public void PushScope()
33 {
35 }
36
37 public void PopScope()
38 {
39 if (0 < _lastScopes)
40 {
42 return;
43 }
44 while (_records[--_lastRecord].scopeCount == 0)
45 {
46 }
49 }
50
51 public void AddNamespace(string prefix, string uri)
52 {
53 AddRecord(prefix, uri);
54 }
55
56 private void AddRecord(string prefix, string uri)
57 {
60 if (_lastRecord == _records.Length)
61 {
65 }
66 _lastScopes = 0;
69 }
70
72 {
73 if (_records[_lastRecord].prefix != null)
74 {
75 AddRecord(null, null);
76 }
77 }
78
80 {
81 string text = LookupNamespace(string.Empty);
82 if (text == null)
83 {
85 }
86 else if (_records[_lastRecord].prefix.Length != 0 || _records[_lastRecord - 1].prefix != null)
87 {
88 AddRecord(null, null);
89 AddRecord(string.Empty, text);
90 }
91 }
92
93 public string LookupNamespace(string prefix)
94 {
95 int num = _lastRecord;
96 while (_records[num].prefix != null)
97 {
98 if (_records[num].prefix == prefix)
99 {
100 return _records[num].nsUri;
101 }
102 num--;
103 }
104 return null;
105 }
106}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
void AddNamespace(string prefix, string uri)
void AddRecord(string prefix, string uri)