/// <summary> /// Redirect and massaging /// </summary> /// <param name="storageType">https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_storagetype.html</param> /// <param name="threadPoolSize"></param> /// <param name="useInternalCaches"></param> /// <param name="iconRef"></param> public void CreateStorage(CbFsStorageType storageType, uint threadPoolSize, bool useInternalCaches, string iconRef = null) { Log.Trace("CreateStorage IN"); try { // Must set StorageType before mounting !! CbFs.StorageType = storageType; // Must set ThreadPoolSize before mounting !! CbFs.MinWorkerThreadCount = 1; CbFs.MaxWorkerThreadCount = threadPoolSize; CbFs.NonexistentFilesCacheEnabled = useInternalCaches; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_nonexistentfilescacheenabled.html CbFs.MetaDataCacheEnabled = useInternalCaches; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_metadatacacheenabled.html CbFs.FileCacheEnabled = useInternalCaches; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_filecacheenabled.html CbFs.ShortFileNameSupport = false; CbFs.ClusterSize = 0;// The value must be a multiple of sector size. Default value of 0 tells the driver to have cluster size equal to sector size. CbFs.SectorSize = 4096; // Make this a local style disk CbFs.StorageCharacteristics = 0; // https://www.eldos.com/forum/read.php?FID=13&TID=3681 // the CallAllOpenCloseCallbacks is going to be forced to be true in the next version, so ensure stuff work here with it. CbFs.CallAllOpenCloseCallbacks = true; // https://www.eldos.com/forum/read.php?FID=13&TID=479 // Pass the creation around, This can then be used to determine which of the already opened flags can be decremented to finally release the handle. CbFs.UseFileCreationFlags = true; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_usefilecreationflags.html CbFs.SerializeCallbacks = true; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_serializecallbacks.html CbFs.ParallelProcessingAllowed = false; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_parallelprocessingallowed.html CbFs.FileSystemName = "NTFS"; // Go create stuff CbFs.CreateStorage(); if (!string.IsNullOrWhiteSpace(iconRef)) { if (!CbFs.IconInstalled(iconRef)) { Log.ErrorException("!IconInstalled", new MissingSatelliteAssemblyException("Requested Icon ref is not installed: " + iconRef)); } else { CbFs.SetIcon(iconRef); } } CbFs.NotifyDirectoryChange("\"", CbFsNotifyFileAction.fanAdded, false); } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { Log.Trace("CreateStorage OUT"); } }
public void RegisterAndInit(string salt, string productNameCbfs, uint threadPoolSize, CbFsStorageType storageType, bool useInternalCaches) { CallbackFileSystem.SetRegistrationKey(salt.FromBuffer()); CallbackFileSystem.Initialize(productNameCbfs); CreateStorage(storageType, threadPoolSize, useInternalCaches); }