Пример #1
0
 public MemoryStreamReader(List<byte[]> bufferList, MemoryStreamMultiplexer multiplexer)
 {
     _bufferList = bufferList;
     _bufferPos = 0;
     _bufferIndex = 0;
     _position = 0;
     _multiplexer = multiplexer;
 }
Пример #2
0
        protected MemoryStreamReader GetLocalFSFile(string path, bool cache)
        {
            var fileStream = File.Open(path, FileMode.Open);
            var memStream = new MemoryStreamMultiplexer();
            var bbuffer = new byte[fileStream.Length];
            fileStream.Read(bbuffer, 0, bbuffer.Length);
            memStream.Write(bbuffer, 0, bbuffer.Length);
            fileStream.Close();
            fileStream.Dispose();

            lock (Requests)
            {
                Requests[path.ToLower()] = cache ? 1 : 0;
            }
            lock (Cache)
            {
                Cache[path.ToLower()] = memStream;
            }
            return memStream.GetReader();
        }