Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DataTableMappingCollection.cs
Go to the documentation of this file.
6
7namespace System.Data.Common;
8
9[ListBindable(false)]
10[Editor("Microsoft.VSDesigner.Data.Design.DataTableMappingCollectionEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
12{
14
15 bool ICollection.IsSynchronized => false;
16
17 object ICollection.SyncRoot => this;
18
19 bool IList.IsReadOnly => false;
20
21 bool IList.IsFixedSize => false;
22
23 object? IList.this[int index]
24 {
25 get
26 {
27 return this[index];
28 }
29 set
30 {
33 }
34 }
35
36 object ITableMappingCollection.this[string index]
37 {
38 get
39 {
40 return this[index];
41 }
42 set
43 {
46 }
47 }
48
49 [Browsable(false)]
51 public int Count
52 {
53 get
54 {
55 if (_items == null)
56 {
57 return 0;
58 }
59 return _items.Count;
60 }
61 }
62
63 private Type ItemType => typeof(DataTableMapping);
64
65 [Browsable(false)]
67 public DataTableMapping this[int index]
68 {
69 get
70 {
72 return _items[index];
73 }
74 set
75 {
78 }
79 }
80
81 [Browsable(false)]
83 public DataTableMapping this[string sourceTable]
84 {
85 get
86 {
88 return _items[index];
89 }
90 set
91 {
94 }
95 }
96
101
106
107 public int Add(object? value)
108 {
111 return Count - 1;
112 }
113
115 {
117 return value;
118 }
119
121 {
123 }
124
125 public void AddRange(Array values)
126 {
128 }
129
131 {
132 if (values == null)
133 {
134 throw ADP.ArgumentNull("values");
135 }
136 foreach (object value2 in values)
137 {
139 }
140 if (doClone)
141 {
142 foreach (ICloneable value3 in values)
143 {
145 }
146 return;
147 }
148 foreach (DataTableMapping value4 in values)
149 {
151 }
152 }
153
155 {
157 }
158
160 {
161 Validate(-1, value);
162 value.Parent = this;
164 }
165
167 {
168 return _items ?? (_items = new List<DataTableMapping>());
169 }
170
171 public void Clear()
172 {
173 if (0 < Count)
174 {
176 }
177 }
178
179 private void ClearWithoutEvents()
180 {
181 if (_items == null)
182 {
183 return;
184 }
185 foreach (DataTableMapping item in _items)
186 {
187 item.Parent = null;
188 }
189 _items.Clear();
190 }
191
192 public bool Contains(string? value)
193 {
194 return -1 != IndexOf(value);
195 }
196
197 public bool Contains(object? value)
198 {
199 return -1 != IndexOf(value);
200 }
201
202 public void CopyTo(Array array, int index)
203 {
205 }
206
207 public void CopyTo(DataTableMapping[] array, int index)
208 {
210 }
211
213 {
215 if (0 > num)
216 {
218 }
219 return _items[num];
220 }
221
223 {
224 return ArrayList().GetEnumerator();
225 }
226
227 public int IndexOf(object? value)
228 {
229 if (value != null)
230 {
232 for (int i = 0; i < Count; i++)
233 {
234 if (_items[i] == value)
235 {
236 return i;
237 }
238 }
239 }
240 return -1;
241 }
242
243 public int IndexOf(string? sourceTable)
244 {
245 if (!string.IsNullOrEmpty(sourceTable))
246 {
247 for (int i = 0; i < Count; i++)
248 {
249 string sourceTable2 = _items[i].SourceTable;
250 if (sourceTable2 != null && ADP.SrcCompare(sourceTable, sourceTable2) == 0)
251 {
252 return i;
253 }
254 }
255 }
256 return -1;
257 }
258
260 {
261 if (!string.IsNullOrEmpty(dataSetTable))
262 {
263 for (int i = 0; i < Count; i++)
264 {
265 string dataSetTable2 = _items[i].DataSetTable;
267 {
268 return i;
269 }
270 }
271 }
272 return -1;
273 }
274
275 public void Insert(int index, object? value)
276 {
279 }
280
282 {
283 if (value == null)
284 {
285 throw ADP.TablesAddNullAttempt("value");
286 }
287 Validate(-1, value);
288 value.Parent = this;
289 ArrayList().Insert(index, value);
290 }
291
292 private void RangeCheck(int index)
293 {
294 if (index < 0 || Count <= index)
295 {
296 throw ADP.TablesIndexInt32(index, this);
297 }
298 }
299
300 private int RangeCheck(string sourceTable)
301 {
302 int num = IndexOf(sourceTable);
303 if (num < 0)
304 {
306 }
307 return num;
308 }
309
310 public void RemoveAt(int index)
311 {
314 }
315
316 public void RemoveAt(string sourceTable)
317 {
320 }
321
322 private void RemoveIndex(int index)
323 {
324 _items[index].Parent = null;
325 _items.RemoveAt(index);
326 }
327
328 public void Remove(object? value)
329 {
332 }
333
335 {
336 if (value == null)
337 {
338 throw ADP.TablesAddNullAttempt("value");
339 }
340 int num = IndexOf(value);
341 if (-1 != num)
342 {
343 RemoveIndex(num);
344 return;
345 }
346 throw ADP.CollectionRemoveInvalidObject(ItemType, this);
347 }
348
350 {
352 _items[index].Parent = null;
353 newValue.Parent = this;
355 }
356
357 private void ValidateType([NotNull] object value)
358 {
359 if (value == null)
360 {
361 throw ADP.TablesAddNullAttempt("value");
362 }
363 if (!ItemType.IsInstanceOfType(value))
364 {
366 }
367 }
368
369 private void Validate(int index, [NotNull] DataTableMapping value)
370 {
371 if (value == null)
372 {
373 throw ADP.TablesAddNullAttempt("value");
374 }
375 if (value.Parent != null)
376 {
377 if (this != value.Parent)
378 {
379 throw ADP.TablesIsNotParent(this);
380 }
381 if (index != IndexOf(value))
382 {
383 throw ADP.TablesIsParent(this);
384 }
385 }
386 string sourceTable = value.SourceTable;
387 if (string.IsNullOrEmpty(sourceTable))
388 {
389 index = 1;
390 do
391 {
392 sourceTable = "SourceTable" + index.ToString(CultureInfo.InvariantCulture);
393 index++;
394 }
395 while (-1 != IndexOf(sourceTable));
396 value.SourceTable = sourceTable;
397 }
398 else
399 {
401 }
402 }
403
404 internal void ValidateSourceTable(int index, string value)
405 {
406 int num = IndexOf(value);
407 if (-1 != num && index != num)
408 {
410 }
411 }
412
415 {
416 if (tableMappings != null)
417 {
418 int num = tableMappings.IndexOf(sourceTable);
419 if (-1 != num)
420 {
421 return tableMappings._items[num];
422 }
423 }
424 if (string.IsNullOrEmpty(sourceTable))
425 {
426 throw ADP.InvalidSourceTable("sourceTable");
427 }
428 return mappingAction switch
429 {
430 MissingMappingAction.Passthrough => new DataTableMapping(sourceTable, dataSetTable),
431 MissingMappingAction.Ignore => null,
432 MissingMappingAction.Error => throw ADP.MissingTableMapping(sourceTable),
434 };
435 }
436}
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
void Add(TKey key, TValue value)
static ArgumentNullException ArgumentNull(string parameter)
Definition ADP.cs:699
static int SrcCompare(string strA, string strB)
Definition ADP.cs:651
static Exception TablesIndexInt32(int index, ITableMappingCollection collection)
Definition ADP.cs:293
static int DstCompare(string strA, string strB)
Definition ADP.cs:952
static Exception TablesIsNotParent(ICollection collection)
Definition ADP.cs:298
static Exception TablesSourceIndex(string srcTable)
Definition ADP.cs:308
static Exception NotADataTableMapping(object value)
Definition ADP.cs:318
static Exception TablesUniqueSourceTable(string srcTable)
Definition ADP.cs:313
static Exception TablesIsParent(ICollection collection)
Definition ADP.cs:303
static ArgumentException CollectionRemoveInvalidObject(Type itemType, ICollection collection)
Definition ADP.cs:830
static Exception InvalidSourceTable(string parameter)
Definition ADP.cs:278
static InvalidOperationException MissingTableMapping(string srcTable)
Definition ADP.cs:223
static Exception TablesAddNullAttempt(string parameter)
Definition ADP.cs:283
static Exception TablesDataSetTable(string cacheTable)
Definition ADP.cs:288
static ArgumentOutOfRangeException InvalidMissingMappingAction(MissingMappingAction value)
Definition ADP.cs:129
DataTableMapping Add(DataTableMapping value)
void Validate(int index, [NotNull] DataTableMapping value)
void AddEnumerableRange(IEnumerable values, bool doClone)
void Insert(int index, DataTableMapping value)
void CopyTo(DataTableMapping[] array, int index)
DataTableMapping Add(string? sourceTable, string? dataSetTable)
static ? DataTableMapping GetTableMappingBySchemaAction(DataTableMappingCollection? tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction)
void Replace(int index, DataTableMapping newValue)
ITableMapping ITableMappingCollection. GetByDataSetTable(string dataSetTableName)
DataTableMapping GetByDataSetTable(string dataSetTable)
static CultureInfo InvariantCulture
ITableMapping Add(string sourceTableName, string dataSetTableName)
ITableMapping GetByDataSetTable(string dataSetTableName)