Show / Hide Table of Contents

Class Element

Inheritance
Object
Element
EventProperty
EventProperty.Choice.Option
BlockModule
ParticleHelper.CollisionSettings
ParticleHelper.ParticleDefinition
ShootingModule.Projectile
CapsuleModCollider.CapsuleWrapper
MapperTypeDefinition
MapperTypeReference
MeshTexturePair
ModCollider
ResourceReference
TransformValues
VanillaBlockType
VanillaEntityType
Implements
IValidatable
Namespace: Modding.Serialization
Assembly: Assembly-CSharp.dll
Syntax
public class Element : IValidatable

Constructors

Element()

Declaration
public Element()

Properties

AttributesUsed

All the attributes applied to this element in the XML file. Used for validating deserialized objects.

Declaration
public string AttributesUsed { get; }
Property Value
Type Description
String

ElementsUsed

All the elements applied as child elements to this element in the XML file. Used for validating deserialized objects.

Declaration
public string ElementsUsed { get; }
Property Value
Type Description
String

FileName

File name of the file this object was deserialized from. Used for generating error messages when deserializing.

Declaration
public string FileName { get; }
Property Value
Type Description
String

LineNumber

Line number of this XML element. Used for generating error messages when deserializing.

Declaration
public int LineNumber { get; }
Property Value
Type Description
Int32

LinePosition

Position within its line of this XML element. Used for generating error messages when deserializing.

Declaration
public int LinePosition { get; }
Property Value
Type Description
Int32

Methods

InvalidData(String, String)

Return this if invalid data is specified during validation.

Declaration
protected bool InvalidData(string elemName, string error)
Parameters
Type Name Description
String elemName

Name of this element.

String error

Error message.

Returns
Type Description
Boolean

False

MissingAttribute(String, String)

Return this if a required attribute is missing during validation.

Declaration
protected bool MissingAttribute(string elemName, string missing)
Parameters
Type Name Description
String elemName

Name of this element.

String missing

Name of the missing attribute.

Returns
Type Description
Boolean

False

MissingElement(String, String)

Return this if a required element is missing during validation.

Declaration
protected bool MissingElement(string elemName, string missing)
Parameters
Type Name Description
String elemName

Name of this element.

String missing

Name of the missing element.

Returns
Type Description
Boolean

False

Validate()

Validation with a default name.

Declaration
protected virtual bool Validate()
Returns
Type Description
Boolean

True if the element is valid, false if not.

Validate(String)

Basic method to override for custom validation logic. Should call base method to also do the normal validation tasks.

Declaration
protected virtual bool Validate(string elementName)
Parameters
Type Name Description
String elementName

Name of the element in the current context, for error messages.

Returns
Type Description
Boolean

true if the element is valid, false if not.

Warn(String, String)

Print a formatted warning during validation.

Declaration
protected void Warn(string elemName, string warning)
Parameters
Type Name Description
String elemName

Name of this element.

String warning

Warning message.

Implements

IValidatable
Back to top Generated by DocFX