Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LocalScopeHandleCollection.cs
Go to the documentation of this file.
3
5
6public readonly struct LocalScopeHandleCollection : IReadOnlyCollection<LocalScopeHandle>, IEnumerable<LocalScopeHandle>, IEnumerable
7{
8 public struct Enumerator : IEnumerator<LocalScopeHandle>, IEnumerator, IDisposable
9 {
10 private readonly MetadataReader _reader;
11
12 private readonly int _lastRowId;
13
14 private int _currentRowId;
15
17
18 object IEnumerator.Current => Current;
19
20 internal Enumerator(MetadataReader reader, int firstRowId, int lastRowId)
21 {
22 _reader = reader;
25 }
26
27 public bool MoveNext()
28 {
30 {
31 _currentRowId = 16777216;
32 return false;
33 }
35 return true;
36 }
37
39 {
40 throw new NotSupportedException();
41 }
42
44 {
45 }
46 }
47
48 public struct ChildrenEnumerator : IEnumerator<LocalScopeHandle>, IEnumerator, IDisposable
49 {
50 private readonly MetadataReader _reader;
51
52 private readonly int _parentEndOffset;
53
54 private readonly int _parentRowId;
55
57
58 private int _currentRowId;
59
61
62 object IEnumerator.Current => Current;
63
65 {
66 _reader = reader;
67 _parentEndOffset = reader.LocalScopeTable.GetEndOffset(parentRowId);
69 _currentRowId = 0;
71 }
72
73 public bool MoveNext()
74 {
76 int num;
77 int num2;
78 switch (currentRowId)
79 {
80 case 16777216:
81 return false;
82 case 0:
83 num = -1;
84 num2 = _parentRowId + 1;
85 break;
86 default:
87 num = _reader.LocalScopeTable.GetEndOffset(currentRowId);
88 num2 = currentRowId + 1;
89 break;
90 }
91 int numberOfRows = _reader.LocalScopeTable.NumberOfRows;
92 int endOffset;
93 while (true)
94 {
96 {
97 _currentRowId = 16777216;
98 return false;
99 }
100 endOffset = _reader.LocalScopeTable.GetEndOffset(num2);
101 if (endOffset > num)
102 {
103 break;
104 }
105 num2++;
106 }
108 {
109 _currentRowId = 16777216;
110 return false;
111 }
113 return true;
114 }
115
117 {
118 throw new NotSupportedException();
119 }
120
122 {
123 }
124 }
125
126 private readonly MetadataReader _reader;
127
128 private readonly int _firstRowId;
129
130 private readonly int _lastRowId;
131
132 public int Count => _lastRowId - _firstRowId + 1;
133
135 {
136 _reader = reader;
137 if (methodDefinitionRowId == 0)
138 {
139 _firstRowId = 1;
140 _lastRowId = reader.LocalScopeTable.NumberOfRows;
141 }
142 else
143 {
145 }
146 }
147
149 {
151 }
152
157
162}
new IEnumerator< T > GetEnumerator()
Enumerator(MetadataReader reader, int firstRowId, int lastRowId)
LocalScopeHandleCollection(MetadataReader reader, int methodDefinitionRowId)
static LocalScopeHandle FromRowId(int rowId)