Class KeyValuesOrNTRO
Namespace: ValveResourceFormat.ResourceTypes
Assembly: ValveResourceFormat.dll
Block that can contain either KVObject or NTRO data.
public class KeyValuesOrNTRO : BlockInheritance
object ← Block ← KeyValuesOrNTRO
Derived
EntityLump, Material, Mesh, Model, Morph, ParticleSystem, PhysAggregateData, PostProcessing, World, WorldNode
Inherited Members
Block.Type, Block.Offset, Block.Size, Block.Resource, Block.Read(BinaryReader), Block.ToString(), Block.WriteText(IndentedTextWriter), Block.Serialize(Stream)
Extension Methods
ResourceDataExtensions.AsKeyValueCollection(Block)
Constructors
KeyValuesOrNTRO()
Initializes a new instance of the KeyValuesOrNTRO class.
public KeyValuesOrNTRO()KeyValuesOrNTRO(BlockType, string)
Initializes a new instance of the KeyValuesOrNTRO class with a specific block type and introspection struct name.
public KeyValuesOrNTRO(BlockType type, string introspectionStructName)Parameters
type BlockType
The block type.
introspectionStructName string
The introspection struct name for NTRO parsing.
Properties
Data
Gets or sets the parsed data as a KVObject.
[AllowNull]
public KVObject Data { get; set; }Property Value
KVObject
Remarks
Can be set to null to release KV3 data. Next probe will deserialize again.
Format
Gets the KV3 format id the data was serialized with, or null for NTRO-backed data.
public KV3ID? Format { get; }Property Value
KV3ID?
Type
Gets the block type.
public override BlockType Type { get; }Property Value
Methods
Read(BinaryReader)
Reads the block data from a binary reader.
public override void Read(BinaryReader reader)Parameters
reader BinaryReader
The binary reader to read from.
Serialize(Stream)
Writes the block data in its binary form, as stored in a resource file. Blocks that do not support serialization throw NotImplementedException.
public override void Serialize(Stream stream)Parameters
stream Stream
The stream to write the block data to.
WriteText(IndentedTextWriter)
Writes a human readable text dump of the block contents. This is the output Block.ToString() returns.
public override void WriteText(IndentedTextWriter writer)Parameters
writer IndentedTextWriter
The writer that receives the text, which handles indentation.
Remarks
Writes the data as KV3 text format, regardless of the backing data source.

