Esempio n. 1
0
        public Stream Open()
        {
            // TODO: Is this faster than not doing it?
            using (var bigStream = new BigStream(this, _offset))
            {
                var result = new MemoryStream((int)Length);

                bigStream.CopyTo(result);

                result.Position = 0;

                return(result);
            }
        }
Esempio n. 2
0
        public Stream Open()
        {
            // TODO: Use System.IO.MemoryMappedFiles
            using (var bigStream = new BigStream(this, _offset))
            {
                var result = new MemoryStream((int)Length);

                bigStream.CopyTo(result);

                result.Position = 0;

                // Check for refpack compression header.
                // C&C3 started using refpack compression for .big archive entries.
                if (RefPackStream.IsProbablyRefPackCompressed(result.GetBuffer()))
                {
                    return(new RefPackStream(result));
                }

                return(result);
            }
        }