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

◆ LoadTopMostTable()

void System.Data.XmlDataLoader.LoadTopMostTable ( DataTable table)
inlineprivate

Definition at line 596 of file XmlDataLoader.cs.

597 {
598 bool flag = _isTableLevel || _dataSet.DataSetName != table.TableName;
599 DataRow dataRow = null;
600 bool flag2 = false;
601 int num = _dataReader.Depth - 1;
603 DataColumnCollection columns = table.Columns;
604 object[] array = new object[columns.Count];
606 {
608 {
609 XmlNode n = attribute.FirstChild;
610 array[dataColumn.Ordinal] = dataColumn.ConvertXmlToObject(GetInitialTextFromNodes(ref n));
611 flag2 = true;
612 }
613 }
614 while (num < _dataReader.Depth)
615 {
616 switch (_dataReader.NodeType)
617 {
618 case XmlNodeType.Element:
619 {
621 if (columnSchema is DataColumn dataColumn2)
622 {
623 if (array[dataColumn2.Ordinal] == null)
624 {
626 flag2 = true;
627 }
628 else
629 {
631 }
632 }
633 else if (columnSchema is DataTable table2)
634 {
636 flag2 = true;
637 }
638 else if (!ProcessXsdSchema())
639 {
640 if (!(flag2 || flag))
641 {
642 return;
643 }
645 }
646 break;
647 }
648 case XmlNodeType.EntityReference:
649 throw ExceptionBuilder.FoundEntity();
650 case XmlNodeType.Text:
651 case XmlNodeType.CDATA:
652 case XmlNodeType.Whitespace:
653 case XmlNodeType.SignificantWhitespace:
654 {
655 string s = _dataReader.ReadString();
656 DataColumn xmlText = table._xmlText;
657 if (xmlText != null && array[xmlText.Ordinal] == null)
658 {
659 array[xmlText.Ordinal] = xmlText.ConvertXmlToObject(s);
660 }
661 break;
662 }
663 default:
665 break;
666 }
667 }
669 for (int num2 = array.Length - 1; num2 >= 0; num2--)
670 {
671 if (array[num2] == null)
672 {
673 DataColumn xmlText = columns[num2];
674 if (xmlText.AllowDBNull && xmlText.ColumnMapping != MappingType.Hidden && !xmlText.AutoIncrement)
675 {
676 array[num2] = DBNull.Value;
677 }
678 }
679 }
680 dataRow = table.Rows.AddWithColumnEvents(array);
681 while (count < _childRowsStack.Count)
682 {
683 DataRow dataRow2 = _childRowsStack.Pop();
684 bool flag3 = dataRow2.RowState == DataRowState.Unchanged;
685 dataRow2.SetNestedParentRow(dataRow, setNonNested: false);
686 if (flag3)
687 {
688 dataRow2._oldRecord = dataRow2._newRecord;
689 }
690 }
691 }
void LoadTable(DataTable table, bool isNested)
void LoadColumn(DataColumn column, object[] foundColumns)
readonly Stack< DataRow > _childRowsStack
string GetInitialTextFromNodes(ref XmlNode n)
XmlToDatasetMap _nodeToSchemaMap
bool FIgnoreNamespace(XmlNode node)
object GetColumnSchema(XmlNode node, bool fIgnoreNamespace)
override XmlAttributeCollection Attributes
Definition XmlElement.cs:93
XmlNodeType NodeType
Definition XmlReader.cs:62
virtual string ReadString()
Definition XmlReader.cs:570

References System.Data.XmlDataLoader._childRowsStack, System.Data.XmlDataLoader._dataReader, System.Data.XmlDataLoader._isTableLevel, System.Data.XmlDataLoader._nodeToSchemaMap, System.Data.XmlDataLoader._topMostNode, System.array, System.Xml.XmlElement.Attributes, System.Data.DataTable.Columns, System.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.XmlReader.Depth, System.Xml.Dictionary, System.Data.XmlDataLoader.FIgnoreNamespace(), System.Data.ExceptionBuilder.FoundEntity(), System.Data.XmlToDatasetMap.GetColumnSchema(), System.Data.XmlDataLoader.GetInitialTextFromNodes(), System.Data.XmlDataLoader.LoadColumn(), System.Data.XmlDataLoader.LoadTable(), System.Xml.XmlReader.NodeType, System.Data.XmlDataLoader.ProcessXsdSchema(), System.Xml.XmlReader.Read(), System.Xml.XmlReader.ReadString(), System.s, System.Data.DataTable.TableName, and System.DBNull.Value.

Referenced by System.Data.XmlDataLoader.LoadData().