private Stream CreateStorageStream() { if (!ES2DirectoryUtility.Exists(settings.filenameData.directoryPath)) { ES2DirectoryUtility.CreateDirectory(settings.filenameData.directoryPath); } return(ES2FileUtility.CreateFileStream(settings.filenameData.filePath, settings.fileMode, settings.bufferSize)); }
private Stream CreateReadStream() { if (settings.optimizeMode == ES2Settings.OptimizeMode.Fast) { return(new MemoryStream(ES2FileUtility.ReadAllBytes(settings.filenameData.filePath))); } else { return(ES2FileUtility.CreateFileStream(settings.filenameData.filePath, ES2Settings.ES2FileMode.Open, settings.bufferSize)); } }
private Stream CreateWriteStream() { if (settings.optimizeMode == ES2Settings.OptimizeMode.Fast) { return(new MemoryStream()); } else { if (!ES2DirectoryUtility.Exists(settings.filenameData.directoryPath)) { ES2DirectoryUtility.CreateDirectory(settings.filenameData.directoryPath); } return(ES2FileUtility.CreateFileStream(settings.filenameData.filePath + "tmp", ES2Settings.ES2FileMode.Create, settings.bufferSize)); } }