C# Class ALFA.ResourceManager

This class implements a resource loader that is compatible with the game's internal resource loader. It can be used to load up files out of the currently loaded module, haks, or game data zip files.
Show file Open project: ALandFarAway/ALFA-Base-Resources Class Usage Examples

Public Methods

Method Description
GetAllResources ( ) : IEnumerable

Get a list of all resources.

GetResource ( OEIResRef ResRef, ushort ResType ) : IResourceEntry

Get a resource by name.

GetResource ( string ResRef, ushort ResType ) : IResourceEntry

Get a resource by name.

GetResourcesByType ( ushort ResType ) : IEnumerable

Get a list of all resources of a given type. Duplicates may exist in the returned list, but the list is ordered in priority order, with the first entry being the most precedent for a given name.

LoadCoreResources ( ) : void

Initiate a load of core module resources only (no haks or zips). The load must be initiated before any resources are requested.

OpenGffResource ( string ResRef, ushort ResType ) : GFFFile

Open a GFF resource by name.

OpenModuleIfo ( ) : GFFFile

This method opens module.ifo for read as a GFF reader.

OpenTwoDAResource ( string ResRef, ushort ResType ) : TwoDAFile

Open a 2DA resource by name

ResourceManager ( string ModuleResName ) : System

Create a new ResourceManager instance.

Private Methods

Method Description
AddModuleCampaign ( GFFFile ModuleIfo, string HomeDirectory, string InstallDirectory ) : void

This routine scans module.ifo for a campaign GUID. If found, a campaign.cam file with the same GUID is searched for and its containing directory is added to the directory resource list.

AddModuleHaks ( GFFFile ModuleIfo, string HomeDirectory, string InstallDirectory ) : void

This routine scans module.ifo for haks to add to the hak list.

LoadResourceRepositories ( ) : void

This method performs demand loading of resource repositories.

LoadResourceRepositories ( bool ModuleOnly ) : void

This method performs demand loading of resource repositories.

Method Details

GetAllResources() public method

Get a list of all resources.
public GetAllResources ( ) : IEnumerable
return IEnumerable

GetResource() public method

Get a resource by name.
public GetResource ( OEIResRef ResRef, ushort ResType ) : IResourceEntry
ResRef OEIResRef Supplies the resref to open.
ResType ushort Supplies the restype code of the resource.
return IResourceEntry

GetResource() public method

Get a resource by name.
public GetResource ( string ResRef, ushort ResType ) : IResourceEntry
ResRef string Supplies the resref to open.
ResType ushort Supplies the restype code of the resource.
return IResourceEntry

GetResourcesByType() public method

Get a list of all resources of a given type. Duplicates may exist in the returned list, but the list is ordered in priority order, with the first entry being the most precedent for a given name.
public GetResourcesByType ( ushort ResType ) : IEnumerable
ResType ushort Supplies the resource type to search for.
return IEnumerable

LoadCoreResources() public method

Initiate a load of core module resources only (no haks or zips). The load must be initiated before any resources are requested.
public LoadCoreResources ( ) : void
return void

OpenGffResource() public method

Open a GFF resource by name.
public OpenGffResource ( string ResRef, ushort ResType ) : GFFFile
ResRef string Supplies the resref to open.
ResType ushort Supplies the restype code of the resource.
return GFFFile

OpenModuleIfo() public method

This method opens module.ifo for read as a GFF reader.
public OpenModuleIfo ( ) : GFFFile
return GFFFile

OpenTwoDAResource() public method

Open a 2DA resource by name
public OpenTwoDAResource ( string ResRef, ushort ResType ) : TwoDAFile
ResRef string Supplies the resref to open
ResType ushort Supplies the restype code of the resource
return TwoDAFile

ResourceManager() public method

Create a new ResourceManager instance.
public ResourceManager ( string ModuleResName ) : System
ModuleResName string Optionally supplies the resource name /// of the module. If null, it will be attempted to be gotten from the /// command line of the server, but this can fail if the server was /// not started with -module on the command line.
return System