using System; namespace Substrate.Nbt { /// /// A concrete representing a . /// public sealed class SchemaNodeArray : SchemaNode { private int _length; /// /// Gets the expected length of the corresponding byte array. /// public int Length { get { return _length; } } /// /// Indicates whether there is an expected length of the corresponding byte array. /// public bool HasExpectedLength { get { return _length > 0; } } /// /// Constructs a new representing a named . /// /// The name of the corresponding . public SchemaNodeArray (string name) : base(name) { _length = 0; } /// /// Constructs a new with additional options. /// /// The name of the corresponding . /// One or more option flags modifying the processing of this node. public SchemaNodeArray (string name, SchemaOptions options) : base(name, options) { _length = 0; } /// /// Constructs a new representing a named with expected length . /// /// The name of the corresponding . /// The expected length of corresponding byte array. public SchemaNodeArray (string name, int length) : base(name) { _length = length; } /// /// Constructs a new with additional options. /// /// The name of the corresponding . /// The expected length of corresponding byte array. /// One or more option flags modifying the processing of this node. public SchemaNodeArray (string name, int length, SchemaOptions options) : base(name, options) { _length = length; } /// /// Constructs a default satisfying the constraints of this node. /// /// A with a sensible default value. public override TagNode BuildDefaultTree () { return new TagNodeByteArray(new byte[_length]); } } }