C# Class TagTool.Cache.ResourceDataManager

Manages resource caches and extracting/injecting resource data.
Exibir arquivo Open project: TheGuardians/TagTool Class Usage Examples

Public Methods

Method Description
Add ( ResourceReference resource, ResourceLocation location, Stream dataStream ) : void

Adds a new resource to a cache.

AddRaw ( ResourceReference resource, ResourceLocation location, byte data ) : void

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

Extract ( ResourceReference resource, Stream outStream ) : void

Extracts and decompresses the data for a resource.

ExtractRaw ( ResourceReference resource ) : byte[]

Extracts raw, compressed resource data.

LoadCache ( ResourceLocation location, string path ) : void

Loads a resource cache from a file.

LoadCacheFromDirectory ( string directory, ResourceLocation cache ) : void

Loads a resource cache from a directory using its default name.

LoadCachesFromDirectory ( string directory ) : void

Loads resource caches from a directory using their default filenames.

Replace ( ResourceReference resource, Stream dataStream ) : void

Compresses and replaces the data for a resource.

ReplaceRaw ( ResourceReference resource, byte data ) : void

Replaces a resource with raw, pre-compressed data.

Private Methods

Method Description
GetCache ( ResourceReference resource ) : LoadedCache

Method Details

Add() public method

Adds a new resource to a cache.
resource The input stream is not open for reading;dataStream
public Add ( ResourceReference resource, ResourceLocation location, Stream dataStream ) : void
resource ResourceReference The resource reference to initialize.
location ResourceLocation The location where the resource should be stored.
dataStream Stream The stream to read the resource data from.
return void

AddRaw() public method

Adds raw, pre-compressed resource data to a cache.
public AddRaw ( ResourceReference resource, ResourceLocation location, byte data ) : void
resource ResourceReference The resource reference to initialize.
location ResourceLocation The location where the resource should be stored.
data byte The pre-compressed data to store.
return void

Extract() public method

Extracts and decompresses the data for a resource.
Thrown if the output stream is not open for writing. Thrown if the file containing the resource has not been loaded.
public Extract ( ResourceReference resource, Stream outStream ) : void
resource ResourceReference The resource.
outStream Stream The stream to write the extracted data to.
return void

ExtractRaw() public method

Extracts raw, compressed resource data.
public ExtractRaw ( ResourceReference resource ) : byte[]
resource ResourceReference The resource.
return byte[]

LoadCache() public method

Loads a resource cache from a file.
Thrown if the cache is already loaded.
public LoadCache ( ResourceLocation location, string path ) : void
location ResourceLocation The resource cache type.
path string The path to the .dat file to read.
return void

LoadCacheFromDirectory() public method

Loads a resource cache from a directory using its default name.
public LoadCacheFromDirectory ( string directory, ResourceLocation cache ) : void
directory string The directory to find the cache in.
cache ResourceLocation The type of cache to load.
return void

LoadCachesFromDirectory() public method

Loads resource caches from a directory using their default filenames.
public LoadCachesFromDirectory ( string directory ) : void
directory string The directory to find files in.
return void

Replace() public method

Compresses and replaces the data for a resource.
Thrown if the input stream is not open for reading.
public Replace ( ResourceReference resource, Stream dataStream ) : void
resource ResourceReference The resource whose data should be replaced. On success, the reference will be adjusted to account for the new data.
dataStream Stream The stream to read the new data from.
return void

ReplaceRaw() public method

Replaces a resource with raw, pre-compressed data.
public ReplaceRaw ( ResourceReference resource, byte data ) : void
resource ResourceReference The resource whose data should be replaced. On success, the reference will be adjusted to account for the new data.
data byte The raw, pre-compressed data to use.
return void