Пример #1
0
        protected override void Read()
        {
            BinaryFormatter formatter = new BinaryFormatter();

            using (var file = new FileStream(InputFilePath, FileMode.Open, FileAccess.Read))
            {
                var totalChunkCount = (long)formatter.Deserialize(file);
                while (file.Position < file.Length)
                {
                    var chunk = (FileChunk)formatter.Deserialize(file);
                    ProcessingQueue.Enqueue(chunk);
                }
            }
            ProcessingQueue.Close();
        }
Пример #2
0
        protected override void Read()
        {
            var buffer       = new byte[ChunkByteSize];
            var chunkCounter = 1;

            using (var file = new FileStream(InputFilePath, FileMode.Open, FileAccess.Read))
            {
                int numBytesRead = file.Read(buffer, 0, ChunkByteSize);

                while (numBytesRead > 0)
                {
                    ProcessingQueue.Enqueue(chunkCounter++, buffer);
                    numBytesRead = file.Read(buffer, 0, buffer.Length);
                }
            }
            ProcessingQueue.Close();
        }