CRM32Pro SDK
v5.22
|
IStuffDPF. More...
IStuffDPF.
Interface to manage DPF.
Public Member Functions | |
int | AddData (int idDPF, DPF_BlockData *info) |
Add a data block to the given DPF. More... | |
int | AddFile (int idDPF, char *filename) |
Add a file to a DPF. More... | |
void | Close (int idDPF) |
Close a DPF. More... | |
int | Compact (char *filename) |
Compact a DPF removing all deleted blocks. It can also fix a block corruption. More... | |
int | Create (char *filename) |
Create a new DPF v4.0. More... | |
int | Delete (int idDPF, DPF_BlockData *info) |
Delete a specific block. More... | |
int | FindFirst (int idDPF, DPF_BlockData *info) |
Find first block on the given DPF. More... | |
int | FindNext (int idDPF, DPF_BlockData *info) |
Find next block. More... | |
void | Flush (int idDPF) |
Flush the given idDPF. More... | |
int | FreeBlock (DPF_BlockData *) |
Free a loaded block. | |
char * | GetFilename (int idDPF) |
Get the filename given a valid idDPF. More... | |
char | GetFragment (int idDPF) |
Return fragmentation percent of given DPF. More... | |
int | GetNumBlocks (int idDPF) |
Return total blocks number(including working and deleted ones) of given DPF. More... | |
int | GetNumDelBlocks (int idDPF) |
Return only deleted blocks number of given DPF. More... | |
int | GetSize (int idDPF) |
Return total file size. More... | |
int | LoadBlock (int idDPF, char *type, char *name, DPF_BlockData *info) |
Load the block that matches the given type and name. More... | |
int | Open (char *filename) |
Load a DPF v4.0. If you open a v3.0, it will update it automatically to v4.0. More... | |
int | Protect (char *filename, unsigned char *key, unsigned char keylen) |
Protect your DPF with heavy encription creating a new DPF. | |
int | Search (int idDPF, DPF_BlockData *info) |
Search for a specific block. More... | |
void | SetAccessMode (char mode) |
Set access mode to blocks on DPF. | |
void | SetPassword (unsigned char *key, unsigned char keylen) |
Set the password to access to your protected DPF. | |
int | UnProtect (char *filename, unsigned char *key, unsigned char keylen) |
Unprotect your previously protected DPF. | |
int CRM32Pro_IStuffDPF::AddData | ( | int | idDPF, |
DPF_BlockData * | info | ||
) |
Add a data block to the given DPF.
idDPF | DPF's ID to add data |
info | filled data block |
int CRM32Pro_IStuffDPF::AddFile | ( | int | idDPF, |
char * | filename | ||
) |
Add a file to a DPF.
idDPF | DPF's ID to add file |
filename | file to be added |
void CRM32Pro_IStuffDPF::Close | ( | int | idDPF | ) |
Close a DPF.
idDPF | DPF's ID to close |
int CRM32Pro_IStuffDPF::Compact | ( | char * | filename | ) |
Compact a DPF removing all deleted blocks. It can also fix a block corruption.
Note that it performs a physical delete. The given DPF must be closed before to call this method.
filename | DPF file name to perform the compact process. |
int CRM32Pro_IStuffDPF::Create | ( | char * | filename | ) |
Create a new DPF v4.0.
filename | name and optional path of the new DPF |
int CRM32Pro_IStuffDPF::Delete | ( | int | idDPF, |
DPF_BlockData * | info | ||
) |
Delete a specific block.
Note this is a logical delete
idDPF | DPF's ID to delete given block |
info | filled data block to search and delete(only name and type are needed) |
int CRM32Pro_IStuffDPF::FindFirst | ( | int | idDPF, |
DPF_BlockData * | info | ||
) |
Find first block on the given DPF.
idDPF | DPF's ID to find first block |
info | filled data block(only info, not data) |
int CRM32Pro_IStuffDPF::FindNext | ( | int | idDPF, |
DPF_BlockData * | info | ||
) |
Find next block.
idDPF | DPF's ID to find next block |
info | filled data block(only info, not data) |
void CRM32Pro_IStuffDPF::Flush | ( | int | idDPF | ) |
Flush the given idDPF.
IStuffDPF uses buffering algorithms to speedup all IO operations. Once you save a data block, it may not be immediately saved to disk. If you want to assure this, you have to flush the given idDPF.
idDPF | DPF's ID to flush |
char * CRM32Pro_IStuffDPF::GetFilename | ( | int | idDPF | ) |
Get the filename given a valid idDPF.
idDPF | DPF's ID to get its filename |
char CRM32Pro_IStuffDPF::GetFragment | ( | int | idDPF | ) |
Return fragmentation percent of given DPF.
idDPF | DPF's ID to get fragment percent |
int CRM32Pro_IStuffDPF::GetNumBlocks | ( | int | idDPF | ) |
Return total blocks number(including working and deleted ones) of given DPF.
idDPF | DPF's ID to count blocks |
int CRM32Pro_IStuffDPF::GetNumDelBlocks | ( | int | idDPF | ) |
Return only deleted blocks number of given DPF.
idDPF | DPF's ID to count deleted blocks |
int CRM32Pro_IStuffDPF::GetSize | ( | int | idDPF | ) |
Return total file size.
idDPF | DPF's ID to get size |
int CRM32Pro_IStuffDPF::LoadBlock | ( | int | idDPF, |
char * | type, | ||
char * | name, | ||
DPF_BlockData * | info | ||
) |
Load the block that matches the given type and name.
Note that once you have finish to work with returned data of info struct, you must free it using FreeBlock().
idDPF | DPF's ID to load block |
type | block type(examples of defined:"FILE","TILE"..) |
name | name of block. It is case sensitive. |
info | when return Ok, it has the required data |
int CRM32Pro_IStuffDPF::Open | ( | char * | filename | ) |
Load a DPF v4.0. If you open a v3.0, it will update it automatically to v4.0.
filename | name of file |
int CRM32Pro_IStuffDPF::Search | ( | int | idDPF, |
DPF_BlockData * | info | ||
) |
Search for a specific block.
idDPF | DPF's ID to find the given block |
info | pointer to DPF_BlockData struct with the name and type to look for. If it is found, it returns more information and data = NULL |