Esempio n. 1
0
        private void GDIFFAdd(Stream Diff, Addition Add)
        {
            //Name	Cmd		Followed By			Action
            //-----------------------------------------------------------
            //DATA	1		1 byte				append 1 data byte
            //DATA	2		2 bytes				append 2 data bytes
            //DATA	<n>		<n> bytes			append <n> data bytes
            //DATA	246		246 bytes			append 246 data bytes
            //DATA	247		ushort, <n> bytes	append <n> data bytes
            //DATA	248		int, <n> bytes		append <n> data bytes

            int iLength = Add.arBytes.Length;
            if (iLength <= 246)
            {
                Diff.WriteByte((byte)iLength);
                Diff.Write(Add.arBytes, 0, iLength);
            }
            else if (iLength <= ushort.MaxValue)
            {
                Diff.WriteByte(247);
                WriteBigEndian(Diff, (ushort)iLength);
                Diff.Write(Add.arBytes, 0, iLength);
            }
            else
            {
                Diff.WriteByte(248);
                WriteBigEndian(Diff, iLength);
                Diff.Write(Add.arBytes, 0, iLength);
            }
        }
Esempio n. 2
0
 protected virtual void EmitAdd(int iVerStart, int iLength, Stream VerFile, AddCopyList List)
 {
     Addition Add = new Addition();
     VerFile.Seek(iVerStart, SeekOrigin.Begin);
     Add.arBytes = new byte[iLength];
     VerFile.Read(Add.arBytes, 0, iLength);
     List.Add(Add);
 }