C# Class FyreVM.Quetzal

Implements the Quetzal saved-game file specification by holding a list of typed data chunks which can be read from or written to streams.
http://www.ifarchive.org/if-archive/infocom/interpreters/specification/savefile_14.txt
显示文件 Open project: ChicagoDave/Zifmia Class Usage Examples

Public Methods

Method Description
CompressMemory ( byte original, int origStart, int origLength, byte changed, int changedStart, int changedLength ) : byte[]

Compresses a block of memory by comparing it with the original version from the game file.

Contains ( string type ) : bool

Checks whether the Quetzal file contains a given chunk type.

DecompressMemory ( byte original, byte delta ) : byte[]

Reconstitutes a changed block of memory by applying a compressed set of differences to the original block from the game file.

FromStream ( Stream stream ) : Quetzal

Loads a collection of chunks from a Quetzal file.

Duplicate chunks are not supported by this class. Only the last chunk of a given type will be available.

Quetzal ( ) : System

Initializes a new chunk collection.

WriteToStream ( Stream stream ) : void

Writes the chunks to a Quetzal file.

this ( string type ) : byte[]

Gets or sets typed data chunks.

Private Methods

Method Description
StrToID ( string type ) : uint

Method Details

CompressMemory() public static method

Compresses a block of memory by comparing it with the original version from the game file.
public static CompressMemory ( byte original, int origStart, int origLength, byte changed, int changedStart, int changedLength ) : byte[]
original byte An array containing the original block of memory.
origStart int The offset within the array where the original block /// starts.
origLength int The length of the original block, in bytes.
changed byte An array containing the changed block to be compressed.
changedStart int The offset within the array where the changed /// block starts.
changedLength int The length of the changed block. This may be /// greater than , but may not be less.
return byte[]

Contains() public method

Checks whether the Quetzal file contains a given chunk type.
public Contains ( string type ) : bool
type string The 4-character type identifier.
return bool

DecompressMemory() public static method

Reconstitutes a changed block of memory by applying a compressed set of differences to the original block from the game file.
public static DecompressMemory ( byte original, byte delta ) : byte[]
original byte The original block of memory.
delta byte The RLE-compressed set of differences, /// prefixed with a 4-byte length. This length may be larger than /// the original block, but not smaller.
return byte[]

FromStream() public static method

Loads a collection of chunks from a Quetzal file.
Duplicate chunks are not supported by this class. Only the last chunk of a given type will be available.
public static FromStream ( Stream stream ) : Quetzal
stream Stream The stream to read from.
return Quetzal

Quetzal() public method

Initializes a new chunk collection.
public Quetzal ( ) : System
return System

WriteToStream() public method

Writes the chunks to a Quetzal file.
public WriteToStream ( Stream stream ) : void
stream Stream The stream to write to.
return void

this() public method

Gets or sets typed data chunks.
public this ( string type ) : byte[]
type string The 4-character type identifier.
return byte[]