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

◆ ReadXmlSchema() [4/5]

void System.Data.DataTable.ReadXmlSchema ( XmlReader reader,
bool denyResolving )
inlinepackageinherited

Definition at line 5690 of file DataTable.cs.

5691 {
5692 long scopeId = DataCommonEventSource.Log.EnterScope("<ds.DataTable.ReadXmlSchema|INFO> {0}, denyResolving={1}", ObjectID, denyResolving);
5693 try
5694 {
5695 DataSet dataSet = new DataSet();
5696 SerializationFormat remotingFormat = RemotingFormat;
5697 dataSet.ReadXmlSchema(reader, denyResolving);
5698 string mainTableName = dataSet.MainTableName;
5699 if (string.IsNullOrEmpty(_tableName) && string.IsNullOrEmpty(mainTableName))
5700 {
5701 return;
5702 }
5703 DataTable dataTable = null;
5704 if (!string.IsNullOrEmpty(_tableName))
5705 {
5706 if (!string.IsNullOrEmpty(Namespace))
5707 {
5709 }
5710 else
5711 {
5712 int num = dataSet.Tables.InternalIndexOf(_tableName);
5713 if (num > -1)
5714 {
5715 dataTable = dataSet.Tables[num];
5716 }
5717 }
5718 }
5719 else
5720 {
5721 string tableNamespace = string.Empty;
5722 int num2 = mainTableName.IndexOf(':');
5723 if (num2 > -1)
5724 {
5725 tableNamespace = mainTableName.Substring(0, num2);
5726 }
5727 string name = mainTableName.Substring(num2 + 1, mainTableName.Length - num2 - 1);
5729 }
5730 if (dataTable == null)
5731 {
5732 string empty = string.Empty;
5733 empty = (string.IsNullOrEmpty(_tableName) ? mainTableName : ((Namespace.Length > 0) ? (Namespace + ":" + _tableName) : _tableName));
5734 throw ExceptionBuilder.TableNotFound(empty);
5735 }
5738 list.Add(dataTable);
5742 if (list2.Count == 0)
5743 {
5744 if (Columns.Count == 0)
5745 {
5747 dataTable2.CloneTo(this, null, skipExpressionColumns: false);
5748 if (DataSet == null && _tableNamespace == null)
5749 {
5750 _tableNamespace = dataTable2.Namespace;
5751 }
5752 }
5753 return;
5754 }
5755 if (string.IsNullOrEmpty(TableName))
5756 {
5757 TableName = dataTable.TableName;
5758 if (!string.IsNullOrEmpty(dataTable.Namespace))
5759 {
5760 Namespace = dataTable.Namespace;
5761 }
5762 }
5763 if (DataSet == null)
5764 {
5765 DataSet dataSet2 = new DataSet(dataSet.DataSetName);
5766 dataSet2.SetLocaleValue(dataSet.Locale, dataSet.ShouldSerializeLocale());
5767 dataSet2.CaseSensitive = dataSet.CaseSensitive;
5768 dataSet2.Namespace = dataSet.Namespace;
5769 dataSet2._mainTableName = dataSet._mainTableName;
5770 dataSet2.RemotingFormat = dataSet.RemotingFormat;
5771 dataSet2.Tables.Add(this);
5772 }
5774 foreach (DataTable item in list)
5775 {
5776 DataTable dataTable3 = DataSet.Tables[item._tableName, item.Namespace];
5777 DataTable dataTable4 = dataSet.Tables[item._tableName, item.Namespace];
5778 foreach (Constraint constraint in dataTable4.Constraints)
5779 {
5780 if (constraint is ForeignKeyConstraint foreignKeyConstraint && foreignKeyConstraint.Table != foreignKeyConstraint.RelatedTable && list.Contains(foreignKeyConstraint.Table) && list.Contains(foreignKeyConstraint.RelatedTable))
5781 {
5782 ForeignKeyConstraint foreignKeyConstraint2 = (ForeignKeyConstraint)foreignKeyConstraint.Clone(dataTable3.DataSet);
5783 if (!dataTable3.Constraints.Contains(foreignKeyConstraint2.ConstraintName))
5784 {
5786 }
5787 }
5788 }
5789 }
5790 foreach (DataRelation item2 in list2)
5791 {
5792 if (!DataSet.Relations.Contains(item2.RelationName))
5793 {
5795 }
5796 }
5797 bool flag = false;
5798 foreach (DataTable item3 in list)
5799 {
5800 foreach (DataColumn column in item3.Columns)
5801 {
5802 flag = false;
5803 if (column.Expression.Length != 0)
5804 {
5805 DataColumn[] dependency = column.DataExpression.GetDependency();
5806 for (int i = 0; i < dependency.Length; i++)
5807 {
5808 if (!list.Contains(dependency[i].Table))
5809 {
5810 flag = true;
5811 break;
5812 }
5813 }
5814 }
5815 if (!flag)
5816 {
5817 DataSet.Tables[item3.TableName, item3.Namespace].Columns[column.ColumnName].Expression = column.Expression;
5818 }
5819 }
5820 flag = false;
5821 }
5822 }
5823 finally
5824 {
5825 DataCommonEventSource.Log.ExitScope(scopeId);
5826 }
5827 }
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
DataRelationCollection Relations
Definition DataSet.cs:393
DataTableCollection Tables
Definition DataSet.cs:396
DataTable CloneHierarchy(DataTable sourceTable, DataSet ds, Hashtable visitedMap)
void CreateTableList(DataTable currentTable, List< DataTable > tableList)
DataColumnCollection Columns
Definition DataTable.cs:327
void CreateRelationList(List< DataTable > tableList, List< DataRelation > relationList)
SerializationFormat RemotingFormat
Definition DataTable.cs:291

References System.Data.DataTable._tableName, System.Data.DataTable._tableNamespace, System.Data.DataRelationCollection.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Data.DataTable.CloneHierarchy(), System.Data.DataTable.Columns, System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.Data.DataRelationCollection.Contains(), System.Data.InternalDataCollectionBase.Count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Data.DataTable.CreateRelationList(), System.Data.DataTable.CreateTableList(), System.Data.DataTable.DataSet, System.Runtime.Serialization.Dictionary, System.item, System.list, System.Data.DataCommonEventSource.Log, System.Data.DataTable.Namespace, System.Data.DataTable.ObjectID, System.Data.DataSet.Relations, System.Data.DataTable.RemotingFormat, System.Data.DataTable.TableName, System.Data.ExceptionBuilder.TableNotFound(), and System.Data.DataSet.Tables.