Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ OrderTables()

DataTable[] System.Xml.XmlDataDocument.OrderTables ( DataSet ds)
inlineprivate

Definition at line 2377 of file XmlDataDocument.cs.

2378 {
2379 DataTable[] array = null;
2380 if (ds == null || ds.Tables.Count == 0)
2381 {
2382 array = Array.Empty<DataTable>();
2383 }
2384 else if (TablesAreOrdered(ds))
2385 {
2386 array = new DataTable[ds.Tables.Count];
2387 ds.Tables.CopyTo(array, 0);
2388 }
2389 if (array == null)
2390 {
2391 array = new DataTable[ds.Tables.Count];
2393 foreach (DataTable table in ds.Tables)
2394 {
2395 if (table.ParentRelations.Count == 0)
2396 {
2397 list.Add(table);
2398 }
2399 }
2400 if (list.Count > 0)
2401 {
2402 foreach (DataTable table2 in ds.Tables)
2403 {
2405 {
2406 list.Add(table2);
2407 }
2408 }
2409 for (int i = 0; i < list.Count; i++)
2410 {
2411 foreach (DataRelation childRelation in list[i].ChildRelations)
2412 {
2413 DataTable childTable = childRelation.ChildTable;
2414 if (!list.Contains(childTable))
2415 {
2417 }
2418 }
2419 }
2420 list.CopyTo(array);
2421 }
2422 else
2423 {
2424 ds.Tables.CopyTo(array, 0);
2425 }
2426 }
2427 return array;
2428 }
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
void Add(TKey key, TValue value)
DataRelationCollection ParentRelations
Definition DataTable.cs:572
bool TablesAreOrdered(DataSet ds)
bool IsSelfRelatedDataTable(DataTable rootTable)

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.array, System.Collections.Generic.Dictionary< TKey, TValue >.CopyTo(), System.Data.InternalDataCollectionBase.Count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.XmlDataDocument.IsSelfRelatedDataTable(), System.list, System.Data.DataTable.ParentRelations, and System.Xml.XmlDataDocument.TablesAreOrdered().

Referenced by System.Xml.XmlDataDocument.LoadTreeFromDataSet().