C# Class TagTool.Cache.ResourceCache

A .dat file containing resource data (e.g. resources.dat).
Datei anzeigen Open project: TheGuardians/TagTool Class Usage Examples

Public Methods

Method Description
Add ( Stream inStream, byte data, uint &compressedSize ) : int

Adds a resource to the cache.

AddRaw ( Stream inStream, byte rawData ) : int

Adds a raw, pre-compressed resource to the cache.

Compress ( Stream inStream, int resourceIndex, byte data ) : uint

Compresses and saves data for a resource.

Decompress ( Stream inStream, int resourceIndex, uint compressedSize, Stream outStream ) : void

Decompresses a resource.

ExtractRaw ( Stream inStream, int resourceIndex, uint compressedSize ) : byte[]

Extracts raw, compressed resource data.

ImportRaw ( Stream inStream, int resourceIndex, byte data ) : void

Overwrites a resource with raw, pre-compressed data.

ResourceCache ( Stream stream ) : System

Loads a resource cache from a stream.

UpdateResourceTable ( BinaryWriter writer ) : void

Private Methods

Method Description
Load ( Stream stream ) : void
NewResource ( ) : int
ResizeResource ( BinaryWriter writer, int resourceIndex, uint minSize ) : uint

Method Details

Add() public method

Adds a resource to the cache.
public Add ( Stream inStream, byte data, uint &compressedSize ) : int
inStream Stream The stream open on the resource cache.
data byte The data to compress.
compressedSize uint On return, the size of the compressed data.
return int

AddRaw() public method

Adds a raw, pre-compressed resource to the cache.
public AddRaw ( Stream inStream, byte rawData ) : int
inStream Stream The stream open on the resource cache.
rawData byte The raw data to add.
return int

Compress() public method

Compresses and saves data for a resource.
public Compress ( Stream inStream, int resourceIndex, byte data ) : uint
inStream Stream The stream open on the resource data. It must have read/write access.
resourceIndex int The index of the resource to edit.
data byte The data to compress.
return uint

Decompress() public method

Decompresses a resource.
public Decompress ( Stream inStream, int resourceIndex, uint compressedSize, Stream outStream ) : void
inStream Stream The stream open on the resource cache.
resourceIndex int The index of the resource to decompress.
compressedSize uint Total size of the compressed data, including chunk headers.
outStream Stream The stream to write the decompressed resource data to.
return void

ExtractRaw() public method

Extracts raw, compressed resource data.
public ExtractRaw ( Stream inStream, int resourceIndex, uint compressedSize ) : byte[]
inStream Stream The stream open on the resource cache.
resourceIndex int The index of the resource to decompress.
compressedSize uint Total size of the compressed data, including chunk headers.
return byte[]

ImportRaw() public method

Overwrites a resource with raw, pre-compressed data.
public ImportRaw ( Stream inStream, int resourceIndex, byte data ) : void
inStream Stream The stream open on the resource cache.
resourceIndex int The index of the resource to overwrite.
data byte The raw, pre-compressed data to overwrite it with.
return void

ResourceCache() public method

Loads a resource cache from a stream.
public ResourceCache ( Stream stream ) : System
stream Stream The stream to read from.
return System

UpdateResourceTable() public method

public UpdateResourceTable ( BinaryWriter writer ) : void
writer System.IO.BinaryWriter
return void