public ChunkFileContextBuilder AddChunkHandler(Type handlerType) { var chunkId = FileChunkHandlerAttribute.GetChunkId(handlerType); if (String.IsNullOrEmpty(chunkId)) { throw new ArgumentException($"The specified type {handlerType.Name} has no FileChunkHandlerAttribute.", nameof(handlerType)); } _handlerTypes.Add(handlerType); return(this); }
public FileChunkHandlerManager(IEnumerable <IFileChunkHandler> handlers) { #if NET4 _chunkHandlers = handlers .Select(h => new KeyValuePair <string, IFileChunkHandler>(FileChunkHandlerAttribute.GetChunkId(h.GetType()), h)) .ToList(); #else _chunkHandlers = handlers .Select(h => KeyValuePair.Create(FileChunkHandlerAttribute.GetChunkId(h.GetType()), h)) .ToList(); #endif }