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

◆ DecodeName()

static ? string System.Xml.XmlConvert.DecodeName ( string? name)
inlinestatic

Definition at line 55 of file XmlConvert.cs.

56 {
57 if (string.IsNullOrEmpty(name))
58 {
59 return name;
60 }
62 int length = name.Length;
63 int num = 0;
64 int num2 = name.IndexOf('_');
67 if (num2 >= 0)
68 {
69 if (s_decodeCharPattern == null)
70 {
71 s_decodeCharPattern = new Regex("_[Xx]([0-9a-fA-F]{4}|[0-9a-fA-F]{8})_");
72 }
74 enumerator = matchCollection.GetEnumerator();
75 int num3 = -1;
76 if (enumerator != null && enumerator.MoveNext())
77 {
78 Match match = (Match)enumerator.Current;
79 num3 = match.Index;
80 }
81 for (int i = 0; i < length - 7 + 1; i++)
82 {
83 if (i != num3)
84 {
85 continue;
86 }
87 if (enumerator.MoveNext())
88 {
89 Match match2 = (Match)enumerator.Current;
90 num3 = match2.Index;
91 }
92 if (stringBuilder == null)
93 {
95 }
96 stringBuilder.Append(name, num, i - num);
97 if (name[i + 6] != '_')
98 {
99 int num4 = FromHex(name[i + 2]) * 268435456 + FromHex(name[i + 3]) * 16777216 + FromHex(name[i + 4]) * 1048576 + FromHex(name[i + 5]) * 65536 + FromHex(name[i + 6]) * 4096 + FromHex(name[i + 7]) * 256 + FromHex(name[i + 8]) * 16 + FromHex(name[i + 9]);
100 if (num4 >= 65536)
101 {
102 if (num4 <= 1114111)
103 {
104 num = i + 7 + 4;
105 XmlCharType.SplitSurrogateChar(num4, out var lowChar, out var highChar);
106 stringBuilder.Append(highChar);
107 stringBuilder.Append(lowChar);
108 }
109 }
110 else
111 {
112 num = i + 7 + 4;
113 stringBuilder.Append((char)num4);
114 }
115 i += 10;
116 }
117 else
118 {
119 num = i + 7;
120 stringBuilder.Append((char)(FromHex(name[i + 2]) * 4096 + FromHex(name[i + 3]) * 256 + FromHex(name[i + 4]) * 16 + FromHex(name[i + 5])));
121 i += 6;
122 }
123 }
124 if (num == 0)
125 {
126 return name;
127 }
128 if (num < length)
129 {
130 stringBuilder.Append(name, num, length - num);
131 }
132 return stringBuilder.ToString();
133 }
134 return name;
135 }
static int FromHex(char digit)
static volatile Regex s_decodeCharPattern
Definition XmlConvert.cs:18

References System.Xml.Dictionary, System.Xml.XmlConvert.FromHex(), System.Text.RegularExpressions.i, System.length, System.Text.StringBuilder.Length, System.match, System.Text.RegularExpressions.name, System.Xml.XmlConvert.s_decodeCharPattern, and System.Xml.XmlCharType.SplitSurrogateChar().

Referenced by System.Runtime.Serialization.Json.DataContractJsonSerializer.ConvertXmlNameToJsonName(), System.Runtime.Serialization.SchemaExporter.ExportGenericInfo(), System.Data.XSDSchema.FindField(), System.Data.XSDSchema.GetTableName(), System.Data.XSDSchema.GetTableNamespace(), System.Data.XSDSchema.HandleAttributeColumn(), System.Data.XDRSchema.HandleColumn(), System.Data.XSDSchema.HandleConstraint(), System.Data.XSDSchema.HandleDataSet(), System.Data.XSDSchema.HandleElementColumn(), System.Data.XSDSchema.HandleKeyref(), System.Data.XSDSchema.HandleRefTableProperties(), System.Data.XSDSchema.HandleRelation(), System.Data.XDRSchema.InstantiateSimpleTable(), System.Data.XSDSchema.InstantiateSimpleTable(), System.Data.XDRSchema.InstantiateTable(), System.Data.XSDSchema.InstantiateTable(), System.Data.XDRSchema.LoadSchema(), System.Data.XSDSchema.LoadSchema(), System.Data.XmlDataLoader.LoadTable(), System.Data.XMLDiffLoader.ProcessErrors(), System.Data.XMLDiffLoader.ProcessErrors(), System.Data.XMLDiffLoader.ReadOldRowData(), System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadSerializationInfo(), System.Data.XSDSchema.SetExtProperties(), System.Data.XSDSchema.SetExtProperties(), System.Xml.Serialization.XmlCustomFormatter.ToXmlName(), System.Xml.Serialization.XmlCustomFormatter.ToXmlNCName(), System.Xml.Serialization.XmlCustomFormatter.ToXmlNmToken(), System.Xml.Serialization.XmlCustomFormatter.ToXmlNmTokens(), System.Xml.Serialization.XmlSerializationReader.ToXmlQualifiedName(), and System.Xml.Serialization.Accessor.UnescapeName().