OpenFile Method

Opens the specified cached file, creating it if necessary.

Syntax

public void OpenFile(string fileId, long realFileSize, bool isLocal, long prefetchSize, long fileContext);
Public Sub OpenFile(ByVal FileId As String, ByVal RealFileSize As Long, ByVal IsLocal As Boolean, ByVal PrefetchSize As Long, ByVal FileContext As Long)

Remarks

This method opens the cached file identified by FileId, creating it if necessary.

The RealFileSize parameter informs the cache of the File Sizes of the real file (i.e., the one in external storage); this size can be changed later using the SetFileSize method. For existing cached files, -1 may be passed to instruct the cache to use the previously-set real file size instead.

The IsLocal parameter specifies whether the file is a local to the cache and does not exist in external storage; refer to the Local Files topic for more information.

The PrefetchSize parameter specifies how much data the cache should prefetch, from external storage, for the file via the ReadData event (which will fire on a background thread). Pass PREFETCH_ALL to prefetch the entire fire, or PREFETCH_ALL to prefetch none of it. This parameter is ignored if IsLocal is true.

The FileContext is may be passed any application-defined value; said value will then be passed through to any ReadData and WriteData events fired for the file.

.NET Standard Notes

To call this method in an asynchronous manner call OpenFileAsync instead. When the method completes (or an error is encountered) the OpenFileCompleted event will fire.

 
 
Copyright (c) 2020 Callback Technologies, Inc. - All rights reserved.
CBFS Cache 2020 .NET Edition - Version 20.0 [Build 7647]