Public Member Functions | |
| HRESULT | Open ([in] RtDWORD dwFlags) |
| HRESULT | GetStreamName ([out, retval] BSTR *pbstrStreamName) |
| HRESULT | GetFlags ([out, retval] RtDWORD *pdwFlags) |
| HRESULT | GetChunksList ([in] RtBOOL bCheckConsistency,[out, retval] VARIANT *pvChunksList) |
| HRESULT | ScanChunksList ([out, retval] VARIANT *pvChunksList) |
| HRESULT | GetChunk ([in] RtDWORD dwIndex,[in] RtDWORD dwFlags,[out, retval] VARIANT *pvRsFileChunk) |
| HRESULT | FindChunk ([in] BSTR bszIID,[in] RtDWORD dwFromIndex,[out, retval] RtDWORD *pdwIndex) |
| HRESULT | AddChunk ([in] VARIANT vRsFileChunk,[in] RtBOOL bMakeCopy) |
| HRESULT | ReplaceChunk ([in] RtDWORD dwIndex,[in] VARIANT vRsFileChunk,[in] RtBOOL bMakeCopy) |
| HRESULT | InsertChunk ([in] RtDWORD dwIndex,[in] VARIANT vRsFileChunk,[in] RtBOOL bMakeCopy) |
| HRESULT | DeleteChunk ([in] RtDWORD dwIndex) |
| HRESULT | Close ([in] RtBOOL bForce) |
| HRESULT IRsFileHandleDisp::Open | ( | [in] RtDWORD | dwFlags | ) |
Use this method to re-open the file if you call the close method or you need change the read-write flags.
| dwFlags | [in] IRsFileHandle::ReFileHandleOpenFlags Possible values:
|
var mainDir = System.GetMainDir();
var target = mainDir + '\\Rs Main Libraries\\AntonPhysics\\nmj.RsObj';
var a = RsFileIO.CreateRsFileHandle(target, 1);
a.open(1);
| HRESULT IRsFileHandleDisp::GetStreamName | ( | [out, retval] BSTR * | pbstrStreamName | ) |
Returns stream/file name of the file that is handled.
var b = a.GetStreamName();
| HRESULT IRsFileHandleDisp::GetFlags | ( | [out, retval] RtDWORD * | pdwFlags | ) |
Returns flags of the stream/file.
var c = a.GetFlags();
| HRESULT IRsFileHandleDisp::GetChunksList | ( | [in] RtBOOL | bCheckConsistency, | |
| [out, retval] VARIANT * | pvChunksList | |||
| ) |
Get current chunks list for stream and check stream consistency.
| bCheckConsistency | [in] If true then check the stream consistency too, so the loaded chunk list is compared with the scanned one. If you specify false, then the chunk list will be loaded from stream. If you are in write mode, you will get current chunk list that could not be consistent with the one stored in the stream. Thus it hasn't sense to specify in this case. If you delete a chunk and set true, then the deleted chunk will be again added. |
var d = a.GetChunksList(true);
var e = d.GetNumChunks();
| HRESULT IRsFileHandleDisp::ScanChunksList | ( | [out, retval] VARIANT * | pvChunksList | ) |
Scan chunks from the current stream. Use this method to detect really written chunks.
var f = a.ScanChunksList();
| HRESULT IRsFileHandleDisp::GetChunk | ( | [in] RtDWORD | dwIndex, | |
| [in] RtDWORD | dwFlags, | |||
| [out, retval] VARIANT * | pvRsFileChunk | |||
| ) |
Get specified chunk from stream.
Next predefined chunks implements appropriated access interface that you can use to read its data or to modify them:
| dwIndex | [in] Index of the chunk you want to read. | |
| dwFlags | [in] Get chunk flags (see IRsFileHandle::ReFHndGetChunFlags):
|
var headr = a.FindChunk('RdChunk Header', -1); var g = a.GetChunk(headr, false);
| HRESULT IRsFileHandleDisp::FindChunk | ( | [in] BSTR | bszIID, | |
| [in] RtDWORD | dwFromIndex, | |||
| [out, retval] RtDWORD * | pdwIndex | |||
| ) |
Find specified by its ID.
| bszIID | [in] Class ID of the chunk. You can use also names of the chunk objects in form: "<Package Name>/<Chunk Name>" -> e.g. "FileIO Package/RdChunk Header" or use these pre-defined string names:
| |
| dwFromIndex | [in] from which chunk index it will be searched. Specify -1 to search from the first chunk. |
Standard HRESULT processing can be applied to the result.
var headr = a.FindChunk('RdChunk Header', -1);
| HRESULT IRsFileHandleDisp::AddChunk | ( | [in] VARIANT | vRsFileChunk, | |
| [in] RtBOOL | bMakeCopy | |||
| ) |
Add chunk to end of the stream.
| vRsFileChunk | [in] the chunk you want to add. | |
| bMakeCopy | [in] If true, a copy of the chunk will be added. |
var addChunk = a.AddChunk('RdChunk Thumbnail', true);
| HRESULT IRsFileHandleDisp::ReplaceChunk | ( | [in] RtDWORD | dwIndex, | |
| [in] VARIANT | vRsFileChunk, | |||
| [in] RtBOOL | bMakeCopy | |||
| ) |
Replace specified chunk.
| dwIndex | [in] Specify index of the chunk you want to replace. | |
| vRsFileChunk | [in] The new chunk. | |
| bMakeCopy | [in] If true, a copy of the chunk will replace the existing chunk. |
var newThumb = System.CreateDO('Common Data Package/Bitmap Data'); target = mainDir + '\\Textures\\checkered.bmp'; newThumb.LoadFromFile(target); var oldThumb = a.FindChunk('RdChunk Thumbnail', -1); a.ReplaceChunk(oldThumb, newThumb, false);
| HRESULT IRsFileHandleDisp::InsertChunk | ( | [in] RtDWORD | dwIndex, | |
| [in] VARIANT | vRsFileChunk, | |||
| [in] RtBOOL | bMakeCopy | |||
| ) |
Insert new chunk at specified position.
| dwIndex | [in] position when the chunk will be inserted. | |
| vRsFileChunk | [in] the chunk you want to add. | |
| bMakeCopy | [in] If true, a copy of the chunk will be inserted. |
var d = a.GetChunksList(true); var e = d.GetNumChunks(); a.InsertChunk(e-1,'RdChunk Thumbnail', copy);
| HRESULT IRsFileHandleDisp::DeleteChunk | ( | [in] RtDWORD | dwIndex | ) |
Delete specified chunk from stream.
| dwIndex | [in] index of the chunk that will be deleted. |
a.DeleteChunk(e-1);
| HRESULT IRsFileHandleDisp::Close | ( | [in] RtBOOL | bForce | ) |
Close stream. If you were creating or modifying the stream,
then call Close method all the changes will be written.
If you don't call this method, then the stream will be closed anyway but as force close.
| bForce | [in] If true the the handle will be closed even an error occurs (e.g. missing chunks or save errors). |
a.close(true);
1.5.5