Пример #1
0
                outFile.WriteUInt64(leaf.TotalLength);
            }

            if (leaf.PayloadData != null)
            {
                outFile.WriteBytes(leaf.PayloadData);
            }
            else
            {
                if (leaf.OriginalPayloadFileOffset > 0)
                {
                    outFile.WriteFromInput(inFile, leaf.OriginalPayloadFileOffset, leaf.PayloadLength);
                }
                else
                {
                    outFile.WriteFromInput(inFile, leaf.PayloadFileOffset, leaf.PayloadLength);
                }
            }
        }
    }
}
Пример #2
0
            else
            {
                outFile.WriteUInt32(1);
                outFile.WriteChars(container.Type.ToCharArray());
                outFile.WriteUInt64(container.TotalLength);
            }

            foreach (var obj in container.Children)
            {
                if (obj is ContainerAtom)
                {
                    SaveContainer(inFile, outFile, (ContainerAtom)obj);
                }
                else
                {
                    SaveAtom(inFile, outFile, (LeafAtom)obj);
                }
            }
        }

        private void SaveAtom(InputFile inFile, OutputFile outFile, LeafAtom leaf)
        {
            if (leaf.HeaderLength == 8)
            {
                outFile.WriteUInt32((UInt32)leaf.TotalLength);
                outFile.WriteChars(leaf.Type.ToCharArray());
            }
            else
            {
                outFile.WriteUInt32(1);
Пример #3
0
        private void SaveAtom(InputFile inFile, OutputFile outFile, LeafAtom leaf)
        {
            if (leaf.HeaderLength == 8)
            {
                outFile.WriteUInt32((UInt32)leaf.TotalLength);
                outFile.WriteChars(leaf.Type.ToCharArray());
            }
            else
            {
                outFile.WriteUInt32(1);
                outFile.WriteChars(leaf.Type.ToCharArray());
                outFile.WriteUInt64(leaf.TotalLength);
            }

            if (leaf.PayloadData != null)
            {
                outFile.WriteBytes(leaf.PayloadData);
            }
            else
            {
                if (leaf.OriginalPayloadFileOffset > 0)
                {
                    outFile.WriteFromInput(inFile, leaf.OriginalPayloadFileOffset, leaf.PayloadLength);
                }
                else
                {
                    outFile.WriteFromInput(inFile, leaf.PayloadFileOffset, leaf.PayloadLength);
                }
            }
        }
Пример #4
0
        private void SaveContainer(InputFile inFile, OutputFile outFile, ContainerAtom container)
        {
            if (container.HeaderLength == 8)
            {
                outFile.WriteUInt32((UInt32)container.TotalLength);
                outFile.WriteChars(container.Type.ToCharArray());
            }
            else
            {
                outFile.WriteUInt32(1);
                outFile.WriteChars(container.Type.ToCharArray());
                outFile.WriteUInt64(container.TotalLength);
            }

            foreach (var obj in container.Children)
            {
                if (obj is ContainerAtom)
                {
                    SaveContainer(inFile, outFile, (ContainerAtom)obj);
                }
                else
                {
                    SaveAtom(inFile, outFile, (LeafAtom)obj);
                }
            }
        }