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

◆ HandleSimpleTypeSimpleContentColumn()

void System.Data.XSDSchema.HandleSimpleTypeSimpleContentColumn ( XmlSchemaSimpleType typeNode,
string strType,
DataTable table,
bool isBase,
XmlAttribute[] attrs,
bool isNillable )
inlinepackage

Definition at line 1635 of file XSDSchema.cs.

1636 {
1637 if (FromInference && table.XmlText != null)
1638 {
1639 return;
1640 }
1641 Type type = null;
1642 SimpleType simpleType = null;
1643 if (typeNode.QualifiedName.Name != null && typeNode.QualifiedName.Name.Length != 0 && typeNode.QualifiedName.Namespace != "http://www.w3.org/2001/XMLSchema")
1644 {
1645 simpleType = new SimpleType(typeNode);
1646 strType = typeNode.QualifiedName.ToString();
1647 type = ParseDataType(typeNode.QualifiedName.ToString());
1648 }
1649 else if (typeNode.BaseXmlSchemaType is XmlSchemaSimpleType xmlSchemaSimpleType && xmlSchemaSimpleType.QualifiedName.Namespace != "http://www.w3.org/2001/XMLSchema")
1650 {
1651 simpleType = new SimpleType(typeNode);
1652 SimpleType simpleType2 = simpleType;
1653 while (simpleType2.BaseSimpleType != null)
1654 {
1655 simpleType2 = simpleType2.BaseSimpleType;
1656 }
1657 type = ParseDataType(simpleType2.BaseType);
1658 strType = simpleType.Name;
1659 }
1660 else
1661 {
1663 }
1664 string text;
1665 if (FromInference)
1666 {
1667 int num = 0;
1668 text = table.TableName + "_Text";
1669 while (table.Columns[text] != null)
1670 {
1671 text += num++;
1672 }
1673 }
1674 else
1675 {
1676 text = table.TableName + "_text";
1677 }
1678 string text2 = text;
1679 bool flag = true;
1680 DataColumn dataColumn;
1681 if (!isBase && table.Columns.Contains(text2, caseSensitive: true))
1682 {
1683 dataColumn = table.Columns[text2];
1684 flag = false;
1685 }
1686 else
1687 {
1688 dataColumn = new DataColumn(text2, type, null, MappingType.SimpleContent);
1689 }
1694 string text3 = null;
1696 if (attrs != null)
1697 {
1698 for (int i = 0; i < attrs.Length; i++)
1699 {
1700 if (attrs[i].LocalName == "AllowDBNull" && attrs[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata" && attrs[i].Value == "false")
1701 {
1702 dataColumn.AllowDBNull = false;
1703 }
1704 if (attrs[i].LocalName == "Ordinal" && attrs[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata")
1705 {
1706 value = attrs[i].Value;
1707 }
1708 if (attrs[i].LocalName == "DefaultValue" && attrs[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata")
1709 {
1710 text3 = attrs[i].Value;
1711 }
1712 }
1713 }
1714 int num2 = (int)Convert.ChangeType(value, typeof(int), null);
1715 if (dataColumn.Expression != null && dataColumn.Expression.Length != 0)
1716 {
1718 }
1719 if (simpleType != null && simpleType.Name != null && simpleType.Name.Length > 0)
1720 {
1721 if (GetMsdataAttribute(typeNode, "targetNamespace") != null)
1722 {
1723 dataColumn.XmlDataType = simpleType.SimpleTypeQualifiedName;
1724 }
1725 }
1726 else
1727 {
1729 }
1731 if (flag)
1732 {
1733 if (FromInference)
1734 {
1735 dataColumn.Prefix = GetPrefix(table.Namespace);
1737 }
1738 if (num2 > -1 && num2 < table.Columns.Count)
1739 {
1740 table.Columns.AddAt(num2, dataColumn);
1741 }
1742 else
1743 {
1744 table.Columns.Add(dataColumn);
1745 }
1746 }
1747 if (text3 != null)
1748 {
1749 try
1750 {
1751 dataColumn.DefaultValue = dataColumn.ConvertXmlToObject(text3);
1752 }
1753 catch (FormatException)
1754 {
1755 throw ExceptionBuilder.CannotConvert(text3, type.FullName);
1756 }
1757 }
1758 }
virtual int Add(object? value)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void HandleColumnExpression(object instance, XmlAttribute[] attrs)
Definition XSDSchema.cs:321
static void SetExtProperties(object instance, XmlAttribute[] attrs)
Definition XSDSchema.cs:282
ArrayList _columnExpressions
Definition XSDSchema.cs:41
Type ParseDataType(string dt)
static string GetMsdataAttribute(XmlSchemaAnnotated node, string ln)
Definition XSDSchema.cs:342
string GetPrefix(string ns)
static void SetProperties(object instance, XmlAttribute[] attrs)
Definition XSDSchema.cs:217
static CultureInfo CurrentCulture

References System.Data.XSDSchema._columnExpressions, System.Data.DataColumnCollection.Add(), System.Collections.ArrayList.Add(), System.Data.DataColumnCollection.AddAt(), System.Data.ExceptionBuilder.CannotConvert(), System.Convert.ChangeType(), System.Data.DataTable.Columns, System.Data.DataColumnCollection.Contains(), System.Data.InternalDataCollectionBase.Count, System.Globalization.CultureInfo.CurrentCulture, System.Xml.Dictionary, System.Data.XSDSchema.FromInference, System.Data.XSDSchema.GetMsdataAttribute(), System.Data.XSDSchema.GetPrefix(), System.Data.XSDSchema.HandleColumnExpression(), System.Data.DataTable.Namespace, System.Data.XSDSchema.ParseDataType(), System.Data.XSDSchema.SetExtProperties(), System.Data.XSDSchema.SetProperties(), System.text, System.ToString, System.type, System.value, and System.Data.DataTable.XmlText.

Referenced by System.Data.XSDSchema.HandleComplexType().