internal static Stream CreateDecoderStream(Stream inStream, long startPos, long[] packSizes, CFolder folderInfo, IPasswordProvider pass)
 {
     int num2;
     int num3;
     if (!folderInfo.CheckStructure())
     {
         throw new NotSupportedException("Unsupported stream binding structure.");
     }
     Stream[] packStreams = new Stream[folderInfo.PackStreams.Count];
     for (int i = 0; i < folderInfo.PackStreams.Count; i++)
     {
         packStreams[i] = new ReadOnlySubStream(inStream, new long?(startPos), packSizes[i]);
         startPos += packSizes[i];
     }
     Stream[] outStreams = new Stream[folderInfo.UnpackSizes.Count];
     FindPrimaryOutStreamIndex(folderInfo, out num2, out num3);
     return CreateDecoderStream(packStreams, packSizes, outStreams, folderInfo, num2, pass);
 }
        internal static Stream CreateDecoderStream(Stream inStream, long startPos, long[] packSizes, CFolder folderInfo,
            IPasswordProvider pass)
        {
            if (!folderInfo.CheckStructure())
                throw new NotSupportedException("Unsupported stream binding structure.");

            Stream[] inStreams = new Stream[folderInfo.PackStreams.Count];
            for (int j = 0; j < folderInfo.PackStreams.Count; j++)
            {
                inStreams[j] = new ReadOnlySubStream(inStream, startPos, packSizes[j]);
                startPos += packSizes[j];
            }

            Stream[] outStreams = new Stream[folderInfo.UnpackSizes.Count];

            int primaryCoderIndex, primaryOutStreamIndex;
            FindPrimaryOutStreamIndex(folderInfo, out primaryCoderIndex, out primaryOutStreamIndex);
            return CreateDecoderStream(inStreams, packSizes, outStreams, folderInfo, primaryCoderIndex, pass);
        }
        internal static Stream CreateDecoderStream(Stream inStream, long startPos, long[] packSizes, CFolder folderInfo,
            IPasswordProvider pass)
        {
            if (!folderInfo.CheckStructure())
                throw new NotSupportedException("Unsupported stream binding structure.");

            // We have multiple views into the same stream which will be used by several threads - need to sync those.
            object sync = new object();
            Stream[] inStreams = new Stream[folderInfo.PackStreams.Count];
            for (int j = 0; j < folderInfo.PackStreams.Count; j++)
            {
                inStreams[j] = new SyncStreamView(sync, inStream, startPos, packSizes[j]);
                startPos += packSizes[j];
            }

            Stream[] outStreams = new Stream[folderInfo.UnpackSizes.Count];

            int primaryCoderIndex, primaryOutStreamIndex;
            FindPrimaryOutStreamIndex(folderInfo, out primaryCoderIndex, out primaryOutStreamIndex);
            return CreateDecoderStream(inStreams, packSizes, outStreams, folderInfo, primaryCoderIndex, pass);
        }