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

◆ SetContentModel()

void System.Xml.Serialization.StructMapping.SetContentModel ( TextAccessor text,
bool hasElements )
inlinepackage

Definition at line 245 of file StructMapping.cs.

246 {
247 if (BaseMapping == null || BaseMapping.TypeDesc.IsRoot)
248 {
249 _hasSimpleContent = !hasElements && text != null && !text.Mapping.IsList;
250 }
252 {
253 if (text != null || hasElements)
254 {
256 }
257 _hasSimpleContent = true;
258 }
259 else
260 {
261 _hasSimpleContent = false;
262 }
263 if (!_hasSimpleContent && text != null && !text.Mapping.TypeDesc.CanBeTextValue && (BaseMapping == null || BaseMapping.TypeDesc.IsRoot || (!text.Mapping.TypeDesc.IsEnum && !text.Mapping.TypeDesc.IsPrimitive)))
264 {
265 throw new InvalidOperationException(System.SR.Format(System.SR.XmlIllegalTypedTextAttribute, base.TypeDesc.FullName, text.Name, text.Mapping.TypeDesc.FullName));
266 }
267 }
static string XmlIllegalSimpleContentExtension
Definition SR.cs:1678
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlIllegalTypedTextAttribute
Definition SR.cs:1676
Definition SR.cs:7

References System.Xml.Serialization.StructMapping._hasSimpleContent, System.Xml.Serialization.StructMapping.BaseMapping, System.Xml.Dictionary, System.SR.Format(), System.Xml.Serialization.TypeDesc.FullName, System.Xml.Serialization.StructMapping.HasSimpleContent, System.Xml.Serialization.TypeDesc.IsRoot, System.text, System.Xml.Serialization.TypeMapping.TypeDesc, System.SR.XmlIllegalSimpleContentExtension, and System.SR.XmlIllegalTypedTextAttribute.