protected StateFunc Params()
        {
            NetInt.ReadInt(delta, cmd.Len1, out param1);
            NetInt.ReadInt(delta, cmd.Len2, out param2);

            return(PatchRun);
        }
示例#2
0
        private StateFunc Magic()
        {
            if (NetInt.ReadInt(stream) != Const.RS_SIG_MAGIC)
            {
                throw new Exception("Bad signature");
            }

            return(Header);
        }
        private StateFunc Header()
        {
            var signature = NetInt.ReadInt(delta);

            if (signature != Const.RS_DELTA_MAGIC)
            {
                throw new Exception();
            }

            return(CommandByte);
        }
示例#4
0
        private StateFunc Header()
        {
            var blockLength  = NetInt.ReadInt(stream);
            var strongLength = NetInt.ReadInt(stream);

            processor.Header(blockLength, strongLength);

            strong = new byte[strongLength];

            return(Read);
        }
示例#5
0
        public void Copy(long start, long length)
        {
            var lStart  = Utils.GetIntLen(start);
            var lLength = Utils.GetIntLen(length);

            var op = ((GetOpcodeOffset(lStart) << 2) + GetOpcodeOffset(lLength)) + 64; // MAGIC

            delta.WriteByte((byte)op);
            NetInt.Write(delta, start, lStart);
            NetInt.Write(delta, length, lLength);
        }
示例#6
0
        private StateFunc Read()
        {
            long weak;

            if (!NetInt.ReadInt(stream, 4, out weak))
            {
                return(Completed);
            }

            stream.Read(strong, 0, strong.Length);

            processor.Chunk((uint)weak, new StrongSum(strong, StrongSumAlgorithm.Md4));

            return(Read);
        }
示例#7
0
        public void Literal(byte[] data, long offset, long count)
        {
            if (count <= 64)
            {
                delta.WriteByte((byte)count);
            }
            else
            {
                var lCount = Utils.GetIntLen(count);
                var op     = GetOpcodeOffset(lCount) + 64;
                delta.WriteByte((byte)op);
                NetInt.Write(delta, count, lCount);
            }

            delta.Write(data, (int)offset, (int)count);
        }
示例#8
0
 public void Header()
 {
     NetInt.Write(delta, Const.RS_DELTA_MAGIC);
 }