Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CaptureCollection.cs
Go to the documentation of this file.
4
6
7[DebuggerDisplay("Count = {Count}")]
9public class CaptureCollection : IList<Capture>, ICollection<Capture>, IEnumerable<Capture>, IEnumerable, IReadOnlyList<Capture>, IReadOnlyCollection<Capture>, IList, ICollection
10{
11 private sealed class Enumerator : IEnumerator<Capture>, IEnumerator, IDisposable
12 {
14
15 private int _index;
16
18 {
19 get
20 {
22 {
24 }
25 return _collection[_index];
26 }
27 }
28
29 object IEnumerator.Current => Current;
30
36
37 public bool MoveNext()
38 {
40 if (_index >= count)
41 {
42 return false;
43 }
44 _index++;
45 return _index < count;
46 }
47
49 {
50 _index = -1;
51 }
52
54 {
55 }
56 }
57
58 private readonly Group _group;
59
60 private readonly int _capcount;
61
62 private Capture[] _captures;
63
64 public bool IsReadOnly => true;
65
66 public int Count => _capcount;
67
68 public Capture this[int i] => GetCapture(i);
69
70 public bool IsSynchronized => false;
71
72 public object SyncRoot => _group;
73
75 {
76 get
77 {
78 return this[index];
79 }
80 set
81 {
83 }
84 }
85
86 bool IList.IsFixedSize => true;
87
88 object? IList.this[int index]
89 {
90 get
91 {
92 return this[index];
93 }
94 set
95 {
97 }
98 }
99
101 {
102 _group = group;
104 }
105
107 {
108 return new Enumerator(this);
109 }
110
115
116 private Capture GetCapture(int i)
117 {
118 if ((uint)i == _capcount - 1)
119 {
120 return _group;
121 }
122 if (i >= _capcount || i < 0)
123 {
125 }
126 if (_captures == null)
127 {
129 }
130 return _captures[i];
131 }
132
133 internal void ForceInitialized()
134 {
136 for (int i = 0; i < _capcount - 1; i++)
137 {
138 _captures[i] = new Capture(_group.Text, _group._caps[i * 2], _group._caps[i * 2 + 1]);
139 }
140 }
141
142 public void CopyTo(Array array, int arrayIndex)
143 {
144 if (array == null)
145 {
147 }
148 int num = arrayIndex;
149 for (int i = 0; i < Count; i++)
150 {
151 array.SetValue(this[i], num);
152 num++;
153 }
154 }
155
156 public void CopyTo(Capture[] array, int arrayIndex)
157 {
158 if (array == null)
159 {
161 }
162 if ((uint)arrayIndex > (uint)array.Length)
163 {
165 }
166 if (array.Length - arrayIndex < Count)
167 {
169 }
170 int num = arrayIndex;
171 for (int i = 0; i < Count; i++)
172 {
173 array[num] = this[i];
174 num++;
175 }
176 }
177
179 {
180 for (int i = 0; i < Count; i++)
181 {
182 if (EqualityComparer<Capture>.Default.Equals(this[i], item))
183 {
184 return i;
185 }
186 }
187 return -1;
188 }
189
194
199
204
209
211 {
212 return ((IList<Capture>)this).IndexOf(item) >= 0;
213 }
214
219
224
229
230 bool IList.Contains(object value)
231 {
232 if (value is Capture item)
233 {
234 return ((ICollection<Capture>)this).Contains(item);
235 }
236 return false;
237 }
238
239 int IList.IndexOf(object value)
240 {
241 if (!(value is Capture item))
242 {
243 return -1;
244 }
245 return ((IList<Capture>)this).IndexOf(item);
246 }
247
252
257
262}
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static string NotSupported_ReadOnlyCollection
Definition SR.cs:28
static string Arg_ArrayPlusOffTooSmall
Definition SR.cs:16
static string EnumNotStarted
Definition SR.cs:30
Definition SR.cs:7
void CopyTo(Capture[] array, int arrayIndex)
static void ThrowArgumentNullException(ExceptionArgument arg)
static void ThrowArgumentOutOfRangeException(ExceptionArgument arg)
void Insert(int index, T item)