GBlorb
Namespace: Casasoft.IF.GBlorbLib
Represents a GBlorb file format, which is used for packaging resources for interactive fiction games.
public class GBlorb
Inheritance Object → GBlorb
Attributes NullableContextAttribute, NullableAttribute
Fields
Data
Gets or sets the raw data of the GBlorb file.
protected Byte[] Data;
Properties
Header
Gets or sets the header of the GBlorb file.
public Header Header { get; protected set; }
Property Value
ResourceIndex
Gets or sets the resource index of the GBlorb file.
public ResourceIndex ResourceIndex { get; protected set; }
Property Value
Chunks
Gets or sets the list of chunks in the GBlorb file.
public List<IChunk> Chunks { get; protected set; }
Property Value
Constructors
GBlorb()
Initializes a new instance of the GBlorb class.
public GBlorb()
GBlorb(String)
Initializes a new instance of the GBlorb class from the specified file.
public GBlorb(string filename)
Parameters
filename
String
The name of the file to read the GBlorb data from.
Methods
ToString()
Returns a string that represents the current GBlorb object.
public string ToString()
Returns
String
A string that represents the current GBlorb object.
Export(String)
Exports the chunks of the GBlorb file to the specified path.
public void Export(string path)
Parameters
path
String
The path to export the chunks to.
Write(String)
Writes the GBlorb data, including the header, resource index, and chunks, to the specified file.
public void Write(string filename)
Parameters
filename
String
The name of the file to write the GBlorb data to.
WriteChunkList(Byte[], Int32, List<IChunk>)
Writes a list of chunks to the specified byte array starting at the given offset.
protected static int WriteChunkList(Byte[] data, int offset, List<IChunk> chunks)
Parameters
data
Byte[]
The byte array to write the chunk data to.
offset
Int32
The offset within the byte array where the chunk data should be written.
chunks
List<IChunk>
The list of chunks to write to the byte array.
Returns
Int32
The updated offset after writing all chunks.
GetResourceChunks()
Gets the list of resource chunks from the GBlorb file.
public List<IChunk> GetResourceChunks()
Returns
List<IChunk>
A list of chunks that are identified as resources.
GetOptionalChunks()
Gets the list of optional chunks from the GBlorb file.
public List<IChunk> GetOptionalChunks()
Returns
List<IChunk>
A list of chunks that are not identified as resources.
GetChunkByTypeAndResourceNumber(String, Int32)
Retrieves a chunk by its type and resource number.
public IChunk GetChunkByTypeAndResourceNumber(string type, int resourceNumber)
Parameters
type
String
The type of the chunk.
resourceNumber
Int32
The resource number of the chunk.
Returns
IChunk
The chunk matching the specified type and resource number, or null if not found.
GetChunkByType(String)
Retrieves a chunk by its type.
public IChunk GetChunkByType(string type)
Parameters
type
String
The type of the chunk to retrieve.
Returns
IChunk
The chunk matching the specified type, or null if not found.
AddUpdateOptionalTextChunk(String, String)
Adds or updates an optional text chunk in the GBlorb file.
public void AddUpdateOptionalTextChunk(string name, string text)
Parameters
name
String
The name of the text chunk.
text
String
The text content to add or update.
AddUpdateFrontispiceChunk(Int32)
Adds or updates the frontispiece chunk in the GBlorb file.
public void AddUpdateFrontispiceChunk(int res)
Parameters
res
Int32
The resource number to set for the frontispiece chunk.