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

◆ HandleSimpleContentColumn()

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

Definition at line 1761 of file XSDSchema.cs.

1762 {
1763 if (FromInference && table.XmlText != null)
1764 {
1765 return;
1766 }
1767 Type type = null;
1768 if (strType == null)
1769 {
1770 return;
1771 }
1773 string text;
1774 if (FromInference)
1775 {
1776 int num = 0;
1777 text = table.TableName + "_Text";
1778 while (table.Columns[text] != null)
1779 {
1780 text += num++;
1781 }
1782 }
1783 else
1784 {
1785 text = table.TableName + "_text";
1786 }
1787 string text2 = text;
1788 bool flag = true;
1789 DataColumn dataColumn;
1790 if (!isBase && table.Columns.Contains(text2, caseSensitive: true))
1791 {
1792 dataColumn = table.Columns[text2];
1793 flag = false;
1794 }
1795 else
1796 {
1797 dataColumn = new DataColumn(text2, type, null, MappingType.SimpleContent);
1798 }
1803 string text3 = null;
1805 if (attrs != null)
1806 {
1807 for (int i = 0; i < attrs.Length; i++)
1808 {
1809 if (attrs[i].LocalName == "AllowDBNull" && attrs[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata" && attrs[i].Value == "false")
1810 {
1811 dataColumn.AllowDBNull = false;
1812 }
1813 if (attrs[i].LocalName == "Ordinal" && attrs[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata")
1814 {
1815 value = attrs[i].Value;
1816 }
1817 if (attrs[i].LocalName == "DefaultValue" && attrs[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata")
1818 {
1819 text3 = attrs[i].Value;
1820 }
1821 }
1822 }
1823 int num2 = (int)Convert.ChangeType(value, typeof(int), null);
1824 if (dataColumn.Expression != null && dataColumn.Expression.Length != 0)
1825 {
1827 }
1829 dataColumn.SimpleType = null;
1830 if (FromInference)
1831 {
1833 }
1834 if (flag)
1835 {
1836 if (FromInference)
1837 {
1839 }
1840 if (num2 > -1 && num2 < table.Columns.Count)
1841 {
1842 table.Columns.AddAt(num2, dataColumn);
1843 }
1844 else
1845 {
1846 table.Columns.Add(dataColumn);
1847 }
1848 }
1849 if (text3 == null)
1850 {
1851 return;
1852 }
1853 try
1854 {
1855 dataColumn.DefaultValue = dataColumn.ConvertXmlToObject(text3);
1856 }
1857 catch (FormatException)
1858 {
1859 throw ExceptionBuilder.CannotConvert(text3, type.FullName);
1860 }
1861 }
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)
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.GetPrefix(), System.Data.XSDSchema.HandleColumnExpression(), 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().