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

◆ GetDefaultStableLocalName()

static string System.Runtime.Serialization.DataContract.GetDefaultStableLocalName ( Type type)
inlinestaticprivateinherited

Definition at line 1758 of file DataContract.cs.

1759 {
1760 if (type.IsGenericParameter)
1761 {
1762 return "{" + type.GenericParameterPosition + "}";
1763 }
1764 string text = null;
1765 if (type.IsArray)
1766 {
1768 }
1769 string text2;
1770 if (type.DeclaringType == null)
1771 {
1772 text2 = type.Name;
1773 }
1774 else
1775 {
1776 int num = ((type.Namespace != null) ? type.Namespace.Length : 0);
1777 if (num > 0)
1778 {
1779 num++;
1780 }
1781 text2 = GetClrTypeFullName(type).Substring(num).Replace('+', '.');
1782 }
1783 if (text != null)
1784 {
1785 text2 = text + text2;
1786 }
1787 if (type.IsGenericType)
1788 {
1791 bool flag = true;
1792 int num2 = text2.IndexOf('[');
1793 if (num2 >= 0)
1794 {
1795 text2 = text2.Substring(0, num2);
1796 }
1798 bool isGenericTypeDefinition = type.IsGenericTypeDefinition;
1799 Type[] genericArguments = type.GetGenericArguments();
1800 for (int i = 0; i < genericArguments.Length; i++)
1801 {
1804 {
1805 stringBuilder.Append('{').Append(i).Append('}');
1806 continue;
1807 }
1809 stringBuilder.Append(stableName.Name);
1810 stringBuilder2.Append(' ').Append(stableName.Namespace);
1811 if (flag)
1812 {
1813 flag = IsBuiltInNamespace(stableName.Namespace);
1814 }
1815 }
1817 {
1818 stringBuilder.Append("{#}");
1819 }
1820 else if (dataContractNameForGenericName.Count > 1 || !flag)
1821 {
1822 foreach (int item in dataContractNameForGenericName)
1823 {
1824 stringBuilder2.Insert(0, item.ToString(CultureInfo.InvariantCulture)).Insert(0, " ");
1825 }
1827 }
1828 text2 = stringBuilder.ToString();
1829 }
1830 return EncodeLocalName(text2);
1831 }
static CultureInfo InvariantCulture
static string EncodeLocalName(string localName)
static string GetNamespacesDigest(string namespaces)
static string GetClrTypeFullName(Type type)
static string GetArrayPrefix(ref Type itemType)
static XmlQualifiedName GetStableName(Type type)
static List< int > GetDataContractNameForGenericName(string typeName, StringBuilder localName)

References System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Runtime.Serialization.Dictionary, System.Runtime.Serialization.DataContract.EncodeLocalName(), System.Runtime.Serialization.DataContract.GetArrayPrefix(), System.Runtime.Serialization.DataContract.GetClrTypeFullName(), System.Runtime.Serialization.DataContract.GetDataContractNameForGenericName(), System.Runtime.Serialization.DataContract.GetNamespacesDigest(), System.Runtime.Serialization.DataContract.GetStableName(), System.Text.RegularExpressions.i, System.Globalization.CultureInfo.InvariantCulture, System.Runtime.Serialization.DataContract.IsBuiltInNamespace(), System.item, System.text, and System.type.

Referenced by System.Runtime.Serialization.DataContract.GetCollectionStableName(), System.Runtime.Serialization.DataContract.GetDCTypeStableName(), System.Runtime.Serialization.DataContract.GetDefaultStableName(), and System.Runtime.Serialization.DataContract.GetNonDCTypeStableName().