예제 #1
0
        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);
        }
예제 #3
0
        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);
 }