Exemple #1
0
            public void Write(Stream hs)
            {
                // Number of UnPacked Streams in Folders

                if (NumUnPackStreamsTotal != unPackInfo.NumFolders && NumUnPackStreamsInFolders.Any())
                {
                    hs.WriteByte((Byte)PropertyID.kNumUnPackStream);

                    for (long i = 0; i < NumUnPackStreamsInFolders.LongLength; ++i)
                    {
                        hs.WriteEncodedUInt64(NumUnPackStreamsInFolders[i]);
                    }
                }

                // UnPackSizes

                if (UnPackSizes.Any())
                {
                    hs.WriteByte((Byte)PropertyID.kSize);

                    List <UInt64> .Enumerator u = UnPackSizes.GetEnumerator();
                    for (long i = 0; i < NumUnPackStreamsInFolders.LongLength; ++i)
                    {
                        for (ulong j = 1; j < NumUnPackStreamsInFolders[i]; ++j)
                        {
                            if (!u.MoveNext())
                            {
                                throw new SevenZipException("Missing `SubStreamInfo.UnPackSize` entry.");
                            }
                            hs.WriteEncodedUInt64(u.Current);
                        }
                        u.MoveNext(); // skip the `unneeded` one
                    }
                }

                // Digests [Number of unknown CRCs]

                if (Digests.NumDefined() > 0)
                {
                    hs.WriteByte((Byte)PropertyID.kCRC);
                    Digests.Write(hs);
                }

                hs.WriteByte((Byte)PropertyID.kEnd);
            }
Exemple #2
0
            public void Write(Stream hs)
            {
                hs.WriteEncodedUInt64(PackPos);
                hs.WriteEncodedUInt64(NumPackStreams);

                hs.WriteByte((Byte)PropertyID.kSize);
                for (ulong i = 0; i < NumPackStreams; ++i)
                {
                    hs.WriteEncodedUInt64(Sizes[i]);
                }

                if (Digests.NumDefined() > 0)
                {
                    hs.WriteByte((Byte)PropertyID.kCRC);
                    Digests.Write(hs);
                }

                hs.WriteByte((Byte)PropertyID.kEnd);
            }
Exemple #3
0
            public void Write(Stream hs)
            {
                hs.WriteByte((Byte)PropertyID.kFolder);

                // Folders

                hs.WriteEncodedUInt64(NumFolders);
                hs.WriteByte(0);
                for (ulong i = 0; i < NumFolders; ++i)
                {
                    Folders[i].Write(hs);
                }

                // CodersUnPackSize in `Folder.UnPackSizes`

                hs.WriteByte((Byte)PropertyID.kCodersUnPackSize);
                for (ulong i = 0; i < NumFolders; ++i)
                {
                    for (ulong j = 0; j < (ulong)Folders[i].UnPackSizes.LongLength; ++j)
                    {
                        hs.WriteEncodedUInt64(Folders[i].UnPackSizes[j]);
                    }
                }

                // UnPackDigests in `Folder.UnPackCRC`

                if (Folders.Any(folder => folder.UnPackCRC != null))
                {
                    hs.WriteByte((Byte)PropertyID.kCRC);

                    var UnPackDigests = new Digests(NumFolders);
                    for (ulong i = 0; i < NumFolders; ++i)
                    {
                        UnPackDigests.CRCs[i] = Folders[i].UnPackCRC;
                    }
                    UnPackDigests.Write(hs);
                }

                hs.WriteByte((Byte)PropertyID.kEnd);
            }