CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
CriFsBinder Class Reference

A module for accessing the content in a CPK file. More...

Inherits CriDisposable.

Classes

struct  ContentsFileInfo
 Content file information structure More...
 

Public Types

enum  Status {
  None, Analyze, Complete, Unbind,
  Removed, Invalid, Error
}
 A value that indicates the status of the binder. More...
 

Public Member Functions

override void Dispose ()
 Discard the binder. More...
 
uint BindCpk (CriFsBinder srcBinder, string path)
 Binds the CPK file. More...
 
uint BindDirectory (CriFsBinder srcBinder, string path)
 Binds the directory path. More...
 
uint BindFile (CriFsBinder srcBinder, string path)
 Binds the file. More...
 
uint BindFileSection (CriFsBinder srcBinder, string path, ulong offset, int size, string sectionName)
 Bind a part of the file so that the part can be treated as a virtual file. More...
 
long GetFileSize (string path)
 Gets the file size. More...
 
long GetFileSize (int id)
 Gets the file size. More...
 
bool GetContentsFileInfo (string path, out ContentsFileInfo info)
 Gets the CPK content file information. More...
 
bool GetContentsFileInfo (int id, out ContentsFileInfo info)
 Gets the CPK content file information. More...
 

Static Public Member Functions

static void Unbind (uint bindId)
 Unbinds the bound content. More...
 
static Status GetStatus (uint bindId)
 Gets the binder status. More...
 
static bool GetContentsFileInfoByIndex (uint bindId, int index, int numFiles, out ContentsFileInfo[] info)
 Gets the CPK content file information. More...
 
static int GetNumContentsFiles (uint bindId)
 Gets the total number of CPK content files. More...
 
static void SetPriority (uint bindId, int priority)
 Sets the search priority for a bind ID. More...
 

Detailed Description

A module for accessing the content in a CPK file.

Description:
CriFsBinder (binder) is a database module to handle files efficiently.
By binding the CPK file or directory to the binder, the content information in the CPK file or directory can be acquired.

Member Enumeration Documentation

enum Status
strong

A value that indicates the status of the binder.

See also
CriFsBinder::GetStatus
Enumerator
None 

Stopped

Analyze 

Binding in progress

Complete 

Binding completed

Unbind 

Unbinding in progress

Removed 

Unbinding complete

Invalid 

Binding disabled

Error 

Binding failed

Member Function Documentation

override void Dispose ( )
inline

Discard the binder.

Note:
If you discard the binder during the binding process or discard the binder without performing the Unbind process, the process may be blocked in this function for a long time.
uint BindCpk ( CriFsBinder  srcBinder,
string  path 
)
inline

Binds the CPK file.

Parameters
srcBinderA binder to access the CPK file to bind
pathPath name of the CPK file to bind
Returns
Bind ID
Description:
To use the CPK file, you need to bind the CPK file.
This function binds the CPK file to the binder and returns the bind ID.

For srcBinder, specify the binder to search for the CPK file.
If srcBinder is set to null, the default device is used.

If the bind cannot be started, 0 is returned as the bind ID.
If a value other than 0 is returned as the bind ID, internal resources are allocated.
So be sure to unbind the bind ID that is no longer required.
(The CPK file being bound is kept open.)

This function returns immediately.
Immediately after returning from this function, CPK binding is not completed yet, so you cannot access the CPK content file.
CPK will be available after the bound state becomes Complete.
You can get the binding status using the CriWare.CriFsBinder::GetStatus function.
See also
CriFsBinder::GetStatus, CriFsBinder::Unbind
uint BindDirectory ( CriFsBinder  srcBinder,
string  path 
)
inline

Binds the directory path.

Parameters
srcBinderThe binder to access the directory to be bound
pathPath name of the directory to be bound
Description:
Binds the directory pathname.
Specify the directory name to bind with an absolute path.

The system does not check whether the directory exists at the time of binding.
Only the directory path is retained in the binder; it does not open the files in the specified directory.
Therefore, unless the bind fails, the bind status of the bind ID is Complete when this function returns.

If the bind cannot be started, 0 is returned as the bind ID.
If a value other than 0 is returned as the bind ID, internal resources are allocated.
So be sure to unbind the bind ID that is no longer required.
Note:
This function is a debug function for development support.
If you use this function, the following problems may occur.
Note:
Be careful not to use this function in the application when final release.
(Convert the data in the directory to a CPK file and bind it using the CriWare.CriFsBinder::BindCpk function, or bind all the files in the directory using the CriWare.CriFsBinder::BindFile function.)
See also
CriFsBinder::GetStatus, CriFsBinder::Unbind, CriFsBinder::BindCpk, CriFsBinder::BindFile
uint BindFile ( CriFsBinder  srcBinder,
string  path 
)
inline

Binds the file.

Parameters
srcBinderThe binder to access the file to be bound
pathThe path name of the file to be bound
Returns
Bind ID
Description:
Binds a file and returns the bind ID.
(Searches and finds the file specified by path from the binder srcBinder.)
If srcBinder is set to null, the default device is used.

If the bind cannot be started, 0 is returned as the bind ID.
If a value other than 0 is returned as the bind ID, internal resources are allocated.
So be sure to unbind the bind ID that is no longer required.
(The CPK file being bound is kept open.)

This function returns immediately.
Immediately after returning from this function, file binding is not completed yet, so you cannot access the files using the bind ID.
The files will be available after the bound status of the bind ID becomes Complete.
You can get the binding status using the CriWare.CriFsBinder::GetStatus function.
See also
CriFsBinder::GetStatus, CriFsBinder::Unbind
uint BindFileSection ( CriFsBinder  srcBinder,
string  path,
ulong  offset,
int  size,
string  sectionName 
)
inline

Bind a part of the file so that the part can be treated as a virtual file.

Parameters
srcBinderThe binder to access the file to be bound
pathThe path name of the file to be bound
offsetData start position (bytes)
sizeData size (bytes)
sectionNameSection name
Returns
Bind ID
Description:
Binds a part of the file and returns the bind ID.
(Searches and finds the file specified by path from the binder srcBinder.)
If srcBinder is set to null, the default device is used.

If the bind cannot be started, 0 is returned as the bind ID.
If a value other than 0 is returned as the bind ID, internal resources are allocated.
So be sure to unbind the bind ID that is no longer required.
(The CPK file being bound is kept open.)
(Specify the section name in the path when loading.)

This function returns immediately.
Immediately after returning from this function, file binding is not completed yet, so you cannot access the files using the bind ID.
The files will be available after the bound status of the bind ID becomes Complete.
You can get the binding status using the CriWare.CriFsBinder::GetStatus function.
See also
CriFsBinder::GetStatus, CriFsBinder::Unbind
static void Unbind ( uint  bindId)
inlinestatic

Unbinds the bound content.

Parameters
bindIdBind ID
Description:
Unbind the bound content.
Specify which content to unbind in the bind ID.
Note:
This function is a return-on-complete function.
It closes files as necessary, so it may take several milliseconds depending on the execution environment.

Other bind IDs that depend on the bind ID to be unbound are also unbound at the same time (implicit unbinding).
For example, the bind IDs that are binding the content files of the CPK bind ID are unbound implicitly when the referencing CPK bind ID is unbound.
See also
CriWare.CriFsBinder::BindCpk, CriFsBinder::BindFile
static Status GetStatus ( uint  bindId)
inlinestatic

Gets the binder status.

Returns
Status
See also
CriFsBinder::Status
long GetFileSize ( string  path)
inline

Gets the file size.

Parameters
pathFull path of the file
Returns
File size
Description:
Gets the file size of the specified file.
Bind IDs whose binding status is Complete are searched.

If the specified file does not exist, a negative value is returned.
Note:
If directories are bound by the CriWare.CriFsBinder::BindDirectory function, processing may be blocked for a long time within this function.
See also
CriFsBinder::GetFileSize(int)
long GetFileSize ( int  id)
inline

Gets the file size.

Parameters
idFile ID
Returns
File size
Description:
Gets the file size.
The CPK file with ID information needs to be bound.
Bind IDs whose binding status is Complete are searched.

If the specified file does not exist, a negative value is returned.
See also
CriFsBinder::GetFileSize(string)
bool GetContentsFileInfo ( string  path,
out ContentsFileInfo  info 
)
inline

Gets the CPK content file information.

Parameters
pathFull path of the file
infoContent file information
Returns
Whether the acquisition succeeded
Description:
Gets the information on the file with the specified file name from the CPK file with ID+ file name information.
The CPK that contains the specified file must be the CPK with ID+ file name information.
If there are multiple files with the same name in the specified binder handle, the CPK containing the first file found will be selected.
See also
CriFsBinder::GetContentsFileInfo(int, out ContentsFileInfo)
bool GetContentsFileInfo ( int  id,
out ContentsFileInfo  info 
)
inline

Gets the CPK content file information.

Parameters
idFile ID
infoContent file information
Returns
Whether the acquisition succeeded
Description:
Gets the information on the file with the specified file ID from the CPK file with ID+ file name information.
The CPK that contains the specified file must be the CPK with ID+ file name information.
If there are multiple files with the same ID in the specified binder handle, the CPK containing the first file found will be selected.
See also
CriFsBinder::GetContentsFileInfo(string, out ContentsFileInfo)
static bool GetContentsFileInfoByIndex ( uint  bindId,
int  index,
int  numFiles,
out ContentsFileInfo[]  info 
)
inlinestatic

Gets the CPK content file information.

Parameters
bindIdBind ID
indexStart index of the content file from which information is obtained
numFilesThe number of content files from which information is obtained
infoContent file information array
Returns
Whether the acquisition succeeded
Description:
Gets the information for the specified number of files from the specified index from the CPK file with ID+ file name information.
The index is assigned starting from 0 to the content file when creating the CPK.
The maximum value that can be specified for index and numFiles is the total number of files that can be acquired using CriWare.CriFsBinder::GetNumContentsFiles .
See also
CriFsBinder::GetContentsFileInfo(string, out ContentsFileInfo), CriFsBinder::GetNumContentsFiles
static int GetNumContentsFiles ( uint  bindId)
inlinestatic

Gets the total number of CPK content files.

Parameters
bindIdBind ID
Returns
The number of content files
Description:
Gets the total number of included files from the CPK file with ID+ file name information.
The return value of this function is the maximum number of content files for obtaining information that can be specified in the CriWare.CriFsBinder::GetContentsFileInfoByIndex function for the same bind ID.
See also
CriFsBinder::GetContentsFileInfoByIndex
static void SetPriority ( uint  bindId,
int  priority 
)
inlinestatic

Sets the search priority for a bind ID.

Parameters
bindIdBind ID
priorityPriority
Description:
Sets the search priority in the binder for the bind ID.
The lowest priority is 0, and the higher the value, the higher the search priority.
For bind IDs with the same priority, the one bound first is found first.
If no priority is set, the default priority is 0.
Bind IDs whose binding status is Complete are searched.

The documentation for this class was generated from the following file: