C# Class TagTool.Cache.ResourceDataManager

Manages resource caches and extracting/injecting resource data.
Afficher le fichier Open project: TheGuardians/TagTool Class Usage Examples

Méthodes publiques

Méthode 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

Méthode Description
GetCache ( ResourceReference resource ) : LoadedCache

Method Details

Add() public méthode

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.
Résultat void

AddRaw() public méthode

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.
Résultat void

Extract() public méthode

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.
Résultat void

ExtractRaw() public méthode

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

LoadCache() public méthode

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.
Résultat void

LoadCacheFromDirectory() public méthode

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.
Résultat void

LoadCachesFromDirectory() public méthode

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

Replace() public méthode

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.
Résultat void

ReplaceRaw() public méthode

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.
Résultat void