CRM32Pro_IStuffDPF Class Reference
[MODULE 3: IStuffDPF v4.3, Data Package Format interface.]

List of all members.

Detailed Description

IStuffDPF.

Interface to manage DPF.


Public Member Functions

int Create (char *filename)
 Create a new DPF v4.0.
int Open (char *filename)
 Load a DPF v4.0. If you open a v3.0, it will update it automatically to v4.0.
void Close (int idDPF)
 Close a DPF.
int AddData (int idDPF, DPF_BlockData *info)
 Add a data block to the given DPF.
int AddFile (int idDPF, char *filename)
 Add a file to a DPF.
int LoadBlock (int idDPF, char *type, char *name, DPF_BlockData *info)
 Load the block that matches the given type and name.
int FreeBlock (DPF_BlockData *)
 Free a loaded block.
int Delete (int idDPF, DPF_BlockData *info)
 Delete a specific block.
int Search (int idDPF, DPF_BlockData *info)
 Search for a specific block.
int FindFirst (int idDPF, DPF_BlockData *info)
 Find first block on the given DPF.
int FindNext (int idDPF, DPF_BlockData *info)
 Find next block.
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.
char * GetFilename (int idDPF)
 Get the filename given a valid idDPF.
void Flush (int idDPF)
 Flush the given idDPF.
int Compact (char *filename)
 Compact a DPF removing all deleted blocks. It can also fix a block corruption.
int Protect (char *filename, unsigned char *key, unsigned char keylen)
 Protect your DPF with heavy encription creating a new DPF.
int UnProtect (char *filename, unsigned char *key, unsigned char keylen)
 Unprotect your previously protected DPF.
int GetNumBlocks (int idDPF)
 Return total blocks number(including working and deleted ones) of given DPF.
int GetNumDelBlocks (int idDPF)
 Return only deleted blocks number of given DPF.
char GetFragment (int idDPF)
 Return fragmentation percent of given DPF.
int GetSize (int idDPF)
 Return total file size.


Member Function Documentation

int CRM32Pro_IStuffDPF::AddData ( int  idDPF,
DPF_BlockData info 
)

Add a data block to the given DPF.

Parameters:
idDPF DPF's ID to add data
info filled data block
Returns:
-1 Data block already exists.

0 Failed.

any other positive value, Ok and packed size of the added block

int CRM32Pro_IStuffDPF::AddFile ( int  idDPF,
char *  filename 
)

Add a file to a DPF.

Parameters:
idDPF DPF's ID to add file
filename file to be added
Returns:
-1 File block already exists.

0 Failed.

any other positive value, Ok and packed size of the added block

void CRM32Pro_IStuffDPF::Close ( int  idDPF  ) 

Close a DPF.

Parameters:
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.

Parameters:
filename DPF file name to perform the compact process.
Returns:
0 Failed

1 Ok

int CRM32Pro_IStuffDPF::Create ( char *  filename  ) 

Create a new DPF v4.0.

Parameters:
filename name and optional path of the new DPF
Returns:
-1 Failed

any other value, the DPF's ID

int CRM32Pro_IStuffDPF::Delete ( int  idDPF,
DPF_BlockData info 
)

Delete a specific block.

Note this is a logical delete

Parameters:
idDPF DPF's ID to delete given block
info filled data block to search and delete(only name and type are needed)
Returns:
0 Failed

1 Ok

int CRM32Pro_IStuffDPF::FindFirst ( int  idDPF,
DPF_BlockData info 
)

Find first block on the given DPF.

Parameters:
idDPF DPF's ID to find first block
info filled data block(only info, not data)
Returns:
0 There was not block found

1 There was block found

2 2 Error

int CRM32Pro_IStuffDPF::FindNext ( int  idDPF,
DPF_BlockData info 
)

Find next block.

Parameters:
idDPF DPF's ID to find next block
info filled data block(only info, not data)
Returns:
0 There was not block found

1 There was block found

2 Error

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.

Parameters:
idDPF DPF's ID to flush

char * CRM32Pro_IStuffDPF::GetFilename ( int  idDPF  ) 

Get the filename given a valid idDPF.

Parameters:
idDPF DPF's ID to get its filename
Returns:
Pointer to a char with the filename

char CRM32Pro_IStuffDPF::GetFragment ( int  idDPF  ) 

Return fragmentation percent of given DPF.

Parameters:
idDPF DPF's ID to get fragment percent
Returns:
0-100 in %. 100% is excellent and with less than 70%, a compaction is needed(using Compact())

int CRM32Pro_IStuffDPF::GetNumBlocks ( int  idDPF  ) 

Return total blocks number(including working and deleted ones) of given DPF.

Parameters:
idDPF DPF's ID to count blocks
Returns:
number of all blocks of the given DPF

int CRM32Pro_IStuffDPF::GetNumDelBlocks ( int  idDPF  ) 

Return only deleted blocks number of given DPF.

Parameters:
idDPF DPF's ID to count deleted blocks
Returns:
0 Failed

any other value, the number of deleted blocks

int CRM32Pro_IStuffDPF::GetSize ( int  idDPF  ) 

Return total file size.

Parameters:
idDPF DPF's ID to get size
Returns:
size in kilobytes of given DPF

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().

Parameters:
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
Returns:
0 Failed

any other value, Ok and the real size(not the packed one) of loaded block

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.

Parameters:
filename name of file
Returns:
-1 Failed

any other value, the DPF's ID(idDPF)

int CRM32Pro_IStuffDPF::Search ( int  idDPF,
DPF_BlockData info 
)

Search for a specific block.

Parameters:
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
Returns:
0 The given block was not found

1 The given block was found

2 Error


The documentation for this class was generated from the following files:
Generated on Sat Oct 20 17:32:23 2007 for CRM32Pro Library by  doxygen 1.4.7