# IRdChunksListDisp Interface Reference

Inherits IDispatch.

List of all members.

## Public Member Functions
HRESULT | GetNumChunks ([out, retval] RtDWORD *pVal)
HRESULT | GetChunkIID ([in] RtDWORD dwIndex,[out, retval] VARIANT *pvChunkIID)
HRESULT | GetChunkCustId ([in] RtDWORD dwIndex,[out, retval] VARIANT *pvCustId)
HRESULT | GetChunkAddress ([in] RtDWORD dwIndex,[out, retval] VARIANT *pvAddress)
HRESULT | GetChunkLength ([in] RtDWORD dwIndex,[out, retval] VARIANT *pvLength)
HRESULT | GetChunkInfoFlags ([in] RtDWORD dwIndex,[out, retval] VARIANT *pvFlags)
HRESULT | Clear ()
HRESULT | SetChunkInfoFlags ([in] RtDWORD dwIndex,[in] RtDWORD dwFlags)
HRESULT | RemoveChunkInfo ([in] RtDWORD dwIndex)
HRESULT | FindChunkByAddr ([in] RtQWORD qwAddress,[in] RtDWORD dwLastInd,[out, retval] RtDWORD *pdwIndex)

## Detailed Description

This chunk allows you fast object scanning for all its chunks. In case of stream/file partial damage, it allows you to extract at least some chunks which survived.

## Member Function Documentation

HRESULT IRdChunksListDisp::GetNumChunks | ( | [out, retval] RtDWORD * | pVal | ) |

Get number of chunks, this Chunk List is not included.

Returns:
  pVal [out, retval] returns total number of chunks.

  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();

HRESULT IRdChunksListDisp::GetChunkIID | ( | [in] RtDWORD | dwIndex,
|  | [out, retval] VARIANT * | pvChunkIID |
| ) |  |  |

Get chunk IID.

Parameters:

  | dwIndex | [in] index of the chunk.

Returns:
  pvChunkIID [out, retval] returns chunk's IID.

  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.GetChunkIID(c-1);
        System.Alert(d);

HRESULT IRdChunksListDisp::GetChunkCustId | ( | [in] RtDWORD | dwIndex,
|  | [out, retval] VARIANT * | pvCustId |
| ) |  |  |

Get chunk's custom identification (usually used as version).

Parameters:

  | dwIndex | [in] index of the chunk.

Returns:
  pvCustId [out, retval] returns chunk's custom Id.

  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.GetChunkCustId(c-1);
        System.Alert(d);

HRESULT IRdChunksListDisp::GetChunkAddress | ( | [in] RtDWORD | dwIndex,
|  | [out, retval] VARIANT * | pvAddress |
| ) |  |  |

Get chunk's start address from beginning of the stream/file.

Parameters:

  | dwIndex | [in] index of the chunk.

Returns:
  pvAddress [out, retval] returns chunk's start address.

  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.GetChunkAddress(c-1);
        System.Alert(d);

HRESULT IRdChunksListDisp::GetChunkLength | ( | [in] RtDWORD | dwIndex,
|  | [out, retval] VARIANT * | pvLength |
| ) |  |  |

Get chunk's length in bytes.

Parameters:

  | dwIndex | [in] index of the chunk.

Returns:
  pvLength [out, retval] returns chunk's length.

  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.GetChunkLength(c-1);
        System.Alert(d);

HRESULT IRdChunksListDisp::GetChunkInfoFlags | ( | [in] RtDWORD | dwIndex,
|  | [out, retval] VARIANT * | pvFlags |
| ) |  |  |

Get chunk's flags. The flags are not stored in the stream/file, they indicates only current chunk's status.
Flags (RdChunksList::ReChunkListInfoFlags):

- RSCHUNK_LST_FLG_MODIFIED (1) - The chunk was modified and its content is different from the one stored in stream/file.
- RSCHUNK_LST_FLG_ERRLOAD (2) - The chunk was written to table, but not found in the stream/file.
- RSCHUNK_LST_FLG_NOT_IN_TABLE (4) - The chunk was found in the stream/file, but was not found in the table.
- RSCHUNK_LST_FLG_INCONSISTENT (8) - The chunk was found in the stream/file and in the table, but are different.
- RSCHUNK_LST_FLG_BAD_SIZE (16)- The chunk was loaded from the stream/file, but size in chunk's header and actual size are different.

Parameters:

  | dwIndex | [in] index of the chunk.

Returns:
  pvFlags [out, retval] returns chunk's flags.

  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.GetChunkInfoFlags(c-1);
        System.Alert(d);

HRESULT IRdChunksListDisp::Clear | ( |  | ) |

Clear the list.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        b.clear();

HRESULT IRdChunksListDisp::SetChunkInfoFlags | ( | [in] RtDWORD | dwIndex,
|  | [in] RtDWORD | dwFlags |
| ) |  |  |

Replace already existing chunk info flags.

Parameters:

  | dwIndex | [in] Index of the existing chunk info that will be replaced.
  | dwFlags | [in] New flags.

Returns:
  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.SetChunkInfoFlags(c-1, 1);
        System.Alert(d);

HRESULT IRdChunksListDisp::RemoveChunkInfo | ( | [in] RtDWORD | dwIndex | ) |

Remove chunk info from the list.

Parameters:

  | dwIndex | [in] Index of the chunk info that will be removed.

Returns:
  Standard HRESULT processing can be applied to the result.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.RemoveChunkInfo(c-1);

HRESULT IRdChunksListDisp::FindChunkByAddr | ( | [in] RtQWORD | qwAddress,
|  | [in] RtDWORD | dwLastInd,
|  | [out, retval] RtDWORD * | pdwIndex |
| ) |  |  |

Find chunk by its address.

Parameters:

  | qwAddress | [in] Address.
  | dwLastInd | [in] Index where search will start. Set to -1 to search from beginning.

Returns:
  pdwIndex [out, retval] Returns index of the chunk if found. If not found, returns -1.

  S_OK if found, S_FALSE if not found.

        var mainDir = System.GetMainDir();
        var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
        var a = RsFileIO.CreateRsFileHandle(target, 1);
        a.close(true);
        a.open(1);
        var b = a.GetChunksList(true);
        var c= b.GetNumChunks();
        var d = b.GetChunkAddress(c-1);
        var e = b.FindChunkByAddr(d);