Class Block
Namespace: ValveResourceFormat
Assembly: ValveResourceFormat.dll
Represents a block within the resource file.
public abstract class BlockInheritance
object ← Block
Derived
BinaryKV1, BinaryKV3, ChoreoSceneFileData, KeyValuesOrNTRO, Map, NTRO, Panorama, ParticleSnapshot, Plaintext, RawBinary, ResourceExtRefList, ResourceManifest, ResponseRules, Sound, SoundStackScript, Texture, UnknownDataBlock, VBIB, VoxelVisibility
Extension Methods
ResourceDataExtensions.AsKeyValueCollection(Block)
Remarks
Get blocks from Resource.Blocks, or by type with Resource.GetBlockByType(BlockType). Cast Resource.DataBlock to the block class that matches the resource type, for example Texture.
Properties
Offset
Gets or sets the offset to the data.
public uint Offset { get; set; }Property Value
uint
Resource
Gets the resource this block belongs to.
public required Resource Resource { get; set; }Property Value
Remarks
Can technically be null if constructed outside of a Resource.
Size
Gets or sets the data size.
public uint Size { get; set; }Property Value
uint
Type
Gets the block type.
public abstract BlockType Type { get; }Property Value
Methods
Read(BinaryReader)
Reads the block data from a binary reader.
public abstract 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 abstract void Serialize(Stream stream)Parameters
stream Stream
The stream to write the block data to.
ToString()
Returns a string that represents the current object.
public override string ToString()Returns
string
A string that represents the current object.
WriteText(IndentedTextWriter)
Writes a human readable text dump of the block contents. This is the output Block.ToString() returns.
public abstract void WriteText(IndentedTextWriter writer)Parameters
writer IndentedTextWriter
The writer that receives the text, which handles indentation.

