public TFChunk AddNewChunk(ChunkHeader chunkHeader, int fileSize) { Ensure.NotNull(chunkHeader, "chunkHeader"); Ensure.Positive(fileSize, "fileSize"); if (chunkHeader.ChunkStartNumber != _chunksCount) { throw new Exception(string.Format("Received request to create a new ongoing chunk {0}-{1}, but current chunks count is {2}.", chunkHeader.ChunkStartNumber, chunkHeader.ChunkEndNumber, _chunksCount)); } var chunkNumber = _chunksCount; var chunkName = _config.FileNamingStrategy.GetFilenameFor(chunkNumber); var chunk = TFChunk.CreateWithHeader(chunkName, chunkHeader, fileSize); AddChunk(chunk); return(chunk); }
public TFChunk CreateTempChunk(ChunkHeader chunkHeader, int fileSize) { var chunkFileName = _config.FileNamingStrategy.GetTempFilename(); return(TFChunk.CreateWithHeader(chunkFileName, chunkHeader, fileSize)); }