protected override async Task <FileObject> CreateFileImplAsync(FileParameters option, CancellationToken cancel = default) { string fileName = this.PathParser.GetFileName(option.Path); if (fileName.IndexOf(Params.SplitStr) != -1) { throw new ApplicationException($"The original filename '{fileName}' contains '{Params.SplitStr}'."); } using (CreatePerTaskCancellationToken(out CancellationToken operationCancel, cancel)) { using (await AsyncLockObj.LockWithAwait(operationCancel)) { cancel.ThrowIfCancellationRequested(); bool isSimplePhysicalFileExists = await UnderlayFileSystem.IsFileExistsAsync(option.Path); if (isSimplePhysicalFileExists) { // If there is a simple physical file, open it. return(await UnderlayFileSystem.CreateFileAsync(option, cancel)); } ParsedPath[] relatedFiles = await GetPhysicalFileStateInternal(option.Path, operationCancel); return(await LargeFileObject.CreateFileAsync(this, option, relatedFiles, operationCancel)); } } }