Beispiel #1
0
        public byte[] Serializer(NashaSettings settings, NashaInstruction instruction)
        {
            var buf = new byte[7];

            buf[0] = (byte)NashaOpcode.Stsfld;
            var(referenceId, field) = (Tuple <short, IField>)instruction.Operand;
            Array.Copy(BitConverter.GetBytes(referenceId), 0, buf, 1, 2);
            Array.Copy(BitConverter.GetBytes(TokenGetter.GetFieldToken(field)), 0, buf, 3, 4);
            return(buf);
        }
Beispiel #2
0
        public byte[] Serializer(NashaSettings settings, NashaInstruction instruction)
        {
            var buf = new byte[8];

            buf[0] = (byte)NashaOpcodes.Ldsfld.ShuffledID;

            var(referenceId, field, isGeneric) = (Tuple <short, IField, bool>)instruction.Operand;
            Array.Copy(BitConverter.GetBytes(isGeneric), 0, buf, 1, 1);
            Array.Copy(BitConverter.GetBytes(referenceId), 0, buf, 2, 2);
            Array.Copy(BitConverter.GetBytes(TokenGetter.GetFieldToken(field)), 0, buf, 4, 4);
            return(buf);
        }