Beispiel #1
0
		internal OpCode(string name, Code code, OperandType operandType, FlowControl flowControl, OpCodeType opCodeType, StackBehaviour push, StackBehaviour pop) {
			this.Name = name;
			this.Code = code;
			this.OperandType = operandType;
			this.FlowControl = flowControl;
			this.OpCodeType = opCodeType;
			this.StackBehaviourPush = push;
			this.StackBehaviourPop = pop;
			if (((ushort)code >> 8) == 0)
				OpCodes.OneByteOpCodes[(byte)code] = this;
			else if (((ushort)code >> 8) == 0xFE)
				OpCodes.TwoByteOpCodes[(byte)code] = this;
		}
Beispiel #2
0
        internal OpCode(int x, int y)
        {
            m_op1 = (byte)((x >> 0) & 0xff);
            m_op2 = (byte)((x >> 8) & 0xff);
            m_code = (Code)((x >> 16) & 0xff);
            m_flowControl = (FlowControl)((x >> 24) & 0xff);
            m_size = 0;
            m_name = "";

            m_opCodeType = (OpCodeType)((y >> 0) & 0xff);
            m_operandType = (OperandType)((y >> 8) & 0xff);
            m_stackBehaviourPop = (StackBehaviour)((y >> 16) & 0xff);
            m_stackBehaviourPush = (StackBehaviour)((y >> 24) & 0xff);
        }
Beispiel #3
0
 internal OpCode(string name, byte op1, byte op2, int size, FlowControl flowControl,
     OpCodeType opCodeType, OperandType operandType,
     StackBehaviour pop, StackBehaviour push)
 {
     m_name = name;
     m_op1 = op1;
     m_op2 = op2;
     m_size = size;
     m_flowControl = flowControl;
     m_opCodeType = opCodeType;
     m_operandType = operandType;
     m_stackBehaviourPop = pop;
     m_stackBehaviourPush = push;
 }
Beispiel #4
0
 internal OpCode(OpCodeValues value, int flags)
 {
     this.m_stringname       = (string)null;
     this.m_pop              = (StackBehaviour)(flags >> 12 & 31);
     this.m_push             = (StackBehaviour)(flags >> 17 & 31);
     this.m_operand          = (OperandType)(flags & 31);
     this.m_type             = (OpCodeType)(flags >> 9 & 7);
     this.m_size             = flags >> 22 & 3;
     this.m_s1               = (byte)((uint)value >> 8);
     this.m_s2               = (byte)value;
     this.m_ctrl             = (FlowControl)(flags >> 5 & 15);
     this.m_endsUncondJmpBlk = (uint)(flags & 16777216) > 0U;
     this.m_stackChange      = flags >> 28;
 }
Beispiel #5
0
 internal OpCode(OpCodeValues value, int flags)
 {
     m_stringname       = null; // computed lazily
     m_pop              = (StackBehaviour)((flags >> StackBehaviourPopShift) & StackBehaviourMask);
     m_push             = (StackBehaviour)((flags >> StackBehaviourPushShift) & StackBehaviourMask);
     m_operand          = (OperandType)(flags & OperandTypeMask);
     m_type             = (OpCodeType)((flags >> OpCodeTypeShift) & OpCodeTypeMask);
     m_size             = (flags >> SizeShift) & SizeMask;
     m_s1               = (byte)((int)value >> 8);
     m_s2               = (byte)(int)value;
     m_ctrl             = (FlowControl)((flags >> FlowControlShift) & FlowControlMask);
     m_endsUncondJmpBlk = (flags & EndsUncondJmpBlkFlag) != 0;
     m_stackChange      = (flags >> StackChangeShift);
 }
Beispiel #6
0
        private void ProcessBinary(OpCodeType opCode)
        {
            ExpressionSyntax rhsVariableExpression = PopVariable();
            ExpressionSyntax lhsVariableExpression = PopVariable();

            SyntaxKind syntaxKind;

            if (opCode == OpCodeType.OP_CONCAT)
            {
                syntaxKind = SyntaxKind.AddExpression;
            }
            else if (opCode == OpCodeType.OP_MINUS)
            {
                syntaxKind = SyntaxKind.SubtractExpression;
            }
            else if (opCode == OpCodeType.OP_DIVIDE)
            {
                syntaxKind = SyntaxKind.DivideExpression;
            }
            else if (opCode == OpCodeType.OP_MULTIPLY)
            {
                syntaxKind = SyntaxKind.MultiplyExpression;
            }
            else if (opCode == OpCodeType.OP_AND)
            {
                syntaxKind = SyntaxKind.LogicalAndExpression;
            }
            else if (opCode == OpCodeType.OP_OR)
            {
                syntaxKind = SyntaxKind.LogicalOrExpression;
            }
            else
            {
                throw new Exception();
            }

            ExpressionSyntax assignment;

            //if (lhsVariableExpression is IdentifierNameSyntax)
            // {
            assignment = SyntaxFactory.BinaryExpression(syntaxKind, lhsVariableExpression, rhsVariableExpression);
            //}
            //else
            //{
            //    assignment = SyntaxFactory.BinaryExpression(syntaxKind, rhsVariableExpression, lhsVariableExpression);
            //}

            stack.Push(assignment);
        }
 public OpCode(
     string name, byte opByte1, byte opByte2,
     OpCodeType type, OperandType operand, FlowControl flowControl,
     StackBehavior pop, StackBehavior push, sbyte stackChange)
 {
     _name        = name;
     _opByte1     = opByte1;
     _opByte2     = opByte2;
     _type        = type;
     _operand     = operand;
     _flowControl = flowControl;
     _pop         = pop;
     _push        = push;
     _stackChange = stackChange;
 }
Beispiel #8
0
	internal OpCode(String stringname, StackBehaviour pop, StackBehaviour push, OperandType operand, OpCodeType type, int size, byte s1, byte s2, FlowControl ctrl, bool endsjmpblk, int stack)
	{
		m_stringname = stringname;
		m_pop = pop;
		m_push = push;
		m_operand = operand;
		m_type = type;
		m_size = size;
		m_s1 = s1;
		m_s2 = s2;
		m_ctrl = ctrl;
		m_endsUncondJmpBlk = endsjmpblk;
		m_stackChange = stack;

	}
Beispiel #9
0
        public void VerifyOpCode(OpCode opCode, string name, OpCodeType opCodeType, OperandType operandType, int size, int value, StackBehaviour stackBehaviourPop, StackBehaviour stackBehaviourPush)
        {
            Assert.Equal(name, opCode.Name);
            Assert.Equal(opCodeType, opCode.OpCodeType);
            Assert.Equal(operandType, opCode.OperandType);
            Assert.Equal(size, opCode.Size);
            Assert.Equal((short)value, opCode.Value);
            Assert.Equal(stackBehaviourPop, opCode.StackBehaviourPop);
            Assert.Equal(stackBehaviourPush, opCode.StackBehaviourPush);
            Assert.Equal(name, opCode.ToString());

            Assert.Equal(opCode.GetHashCode(), opCode.GetHashCode());

            Assert.True(opCode.Equals(opCode));
            Assert.False(opCode.Equals("OpCode"));
            Assert.False(opCode.Equals(null));
        }
Beispiel #10
0
        private Operation GetOperation(OpCodeType type, int n)
        {
            var size = 1;

            switch (type)
            {
            case OpCodeType.STACK: size = OP_STACK_SIZE; break;

            case OpCodeType.CALC: size = OP_CALC_SIZE; break;

            case OpCodeType.OUTPUT: size = OP_OUTPUT_SIZE; break;

            case OpCodeType.INPUT: size = OP_INPUT_SIZE; break;
            }

            return(new Operation((OpCode)(n % size + type)));
        }
Beispiel #11
0
        private static OpCode GetOpCode(Type type, OpCodeType codeType)
        {
            var code = GetTypeCode(type);

            switch (codeType)
            {
            case OpCodeType.Conv:
                return(SConvOpCodes[code]);

            case OpCodeType.Ldind:
                return(SLdindOpCodes[code]);

            case OpCodeType.Stind:
                return(SStindOpCodes[code]);
            }

            return(OpCodes.Nop);
        }
Beispiel #12
0
 internal OpCode(string name, Code code, OperandType operandType, FlowControl flowControl, OpCodeType opCodeType, StackBehaviour push, StackBehaviour pop)
 {
     this.Name               = name;
     this.Code               = code;
     this.OperandType        = operandType;
     this.FlowControl        = flowControl;
     this.OpCodeType         = opCodeType;
     this.StackBehaviourPush = push;
     this.StackBehaviourPop  = pop;
     if (((ushort)code >> 8) == 0)
     {
         OpCodes.OneByteOpCodes[(byte)code] = this;
     }
     else if (((ushort)code >> 8) == 0xFE)
     {
         OpCodes.TwoByteOpCodes[(byte)code] = this;
     }
 }
Beispiel #13
0
    private bool VerifyOpCodeType(OpCode op1, OpCodeType oct, string errNum)
    {
        bool retVal = true;

        try
        {
            if (op1.OpCodeType != oct)
            {
                TestLibrary.TestFramework.LogError(errNum, "Result is not the value as expected,OpCodeType is: " + op1.OpCodeType + ",Expected is: " + oct);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError(errNum, "Unexpected exception: " + e);
            retVal = false;
        }
        return(retVal);
    }
Beispiel #14
0
    private bool VerifyOpCodeType(OpCode op1, OpCodeType oct, string errNum)
    {
        bool retVal = true;

        try
        {
            if (op1.OpCodeType != oct)
            {
                TestLibrary.TestFramework.LogError(errNum, "Result is not the value as expected,OpCodeType is: " + op1.OpCodeType + ",Expected is: " + oct);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError(errNum, "Unexpected exception: " + e);
            retVal = false;
        }
        return retVal;
    }
Beispiel #15
0
	// Construct a new opcode.
	internal OpCode(String name, int value, FlowControl flowControl,
					OpCodeType opcodeType, OperandType operandType,
					StackBehaviour stackPop, StackBehaviour stackPush)
			{
				this.name = name;
				this.value = (short)value;
				this.flowControl = (byte)flowControl;
				this.opcodeType = (byte)opcodeType;
				this.operandType = (byte)operandType;
				if(value < 0x0100)
				{
					this.size = (byte)1;
				}
				else
				{
					this.size = (byte)2;
				}
				this.stackPop = (byte)stackPop;
				this.stackPush = (byte)stackPush;
			}
Beispiel #16
0
 // Construct a new opcode.
 internal OpCode(String name, int value, FlowControl flowControl,
                 OpCodeType opcodeType, OperandType operandType,
                 StackBehaviour stackPop, StackBehaviour stackPush)
 {
     this.name        = name;
     this.value       = (short)value;
     this.flowControl = (byte)flowControl;
     this.opcodeType  = (byte)opcodeType;
     this.operandType = (byte)operandType;
     if (value < 0x0100)
     {
         this.size = (byte)1;
     }
     else
     {
         this.size = (byte)2;
     }
     this.stackPop  = (byte)stackPop;
     this.stackPush = (byte)stackPush;
 }
        private void Write(byte[] buffer, OpCodeType opCode)
        {
            byte[] header = new byte[10];
            int    size   = buffer == null ? 0 : buffer.Length;

            header[0] = (byte)((1 << 7) | (byte)opCode);
            int i = -1;

            if (i <= size)
            {
                header[1] = (byte)size;
                i         = 2;
            }
            else if (size >= 126 && size <= 65535)
            {
                header[1] = 126;
                header[2] = (byte)((size >> 8) & 255);
                header[3] = (byte)((size) & 255);
                i         = 4;
            }
            else
            {
                header[1] = 127;
                header[2] = (byte)((size >> 56) & 255);
                header[3] = (byte)((size >> 48) & 255);
                header[4] = (byte)((size >> 40) & 255);
                header[5] = (byte)((size >> 32) & 255);
                header[6] = (byte)((size >> 24) & 255);
                header[7] = (byte)((size >> 16) & 255);
                header[8] = (byte)((size >> 8) & 255);
                header[9] = (byte)((size) & 255);
                i         = 10;
            }

            if (buffer != null)
            {
                Array.Resize(ref header, i + size);
                Array.Copy(buffer, 0, header, i, size);
            }
            base.Write(header);
        }
Beispiel #18
0
        internal OpCode(string name, byte op1, byte op2, int size,
			Code code, FlowControl flowControl,
			OpCodeType opCodeType, OperandType operandType,
			StackBehaviour pop, StackBehaviour push)
        {
            m_name = name;
            m_op1 = op1;
            m_op2 = op2;
            m_size = size;
            m_code = code;
            m_flowControl = flowControl;
            m_opCodeType = opCodeType;
            m_operandType = operandType;
            m_stackBehaviourPop = pop;
            m_stackBehaviourPush = push;

            if (op1 == 0xff)
                OpCodes.OneByteOpCode [op2] = this;
            else
                OpCodes.TwoBytesOpCode [op2] = this;
        }
Beispiel #19
0
 internal OpCode(string name, Code code, OperandType operandType, FlowControl flowControl, OpCodeType opCodeType, StackBehaviour push, StackBehaviour pop, bool experimental = false)
 {
     Name               = name;
     Code               = code;
     OperandType        = operandType;
     FlowControl        = flowControl;
     OpCodeType         = opCodeType;
     StackBehaviourPush = push;
     StackBehaviourPop  = pop;
     if (!experimental)
     {
         if (((ushort)code >> 8) == 0)
         {
             OpCodes.OneByteOpCodes[(byte)code] = this;
         }
         else if (((ushort)code >> 8) == 0xFE)
         {
             OpCodes.TwoByteOpCodes[(byte)code] = this;
         }
     }
 }
Beispiel #20
0
 //verify the opcode fields
 //if not equal,retun the field name which contains error. 
 private CompareResult CompareOpCode(
     OpCode opcode,
     String stringname,
     StackBehaviour pop,
     StackBehaviour push,
     OperandType operand,
     OpCodeType type,
     int size,
     byte s1,
     byte s2,
     FlowControl ctrl)
 {
     CompareResult returnValue = CompareResult.Equal;
     if (opcode.Name != stringname) returnValue = returnValue | CompareResult.Name;
     if (opcode.StackBehaviourPop != pop) returnValue = returnValue | CompareResult.Pop;
     if (opcode.StackBehaviourPush != push) returnValue = returnValue | CompareResult.Push;
     if (opcode.OperandType != operand) returnValue = returnValue | CompareResult.OpenrandType;
     if (opcode.OpCodeType != type) returnValue = returnValue | CompareResult.OpCodeType;
     if (opcode.Size != size) returnValue = returnValue | CompareResult.Size;
     if (size == 2)
     {
         if (opcode.Value != ((short)(s1 << 8 | s2)))
         {
             returnValue = returnValue | CompareResult.Value;
         }
     }
     else
     {
         if (opcode.Value != ((short)s2))
         {
             returnValue = returnValue | CompareResult.Value;
         }
     }
     if (opcode.FlowControl != ctrl)
     {
         returnValue = returnValue | CompareResult.FlowControl;
     }
     return returnValue;
 }
Beispiel #21
0
        //发送消息,先放进队列中
        public void SendMsg(IMessage msg, OpCodeType opCodeType, Action <IMessage> OnSuccess, Action <ErrorInfo> OnFail)//登录的时候记得获取uid
        {
            byte[]      byteData  = ProtoSerAndUnSer.Serialize(msg);
            CSServerReq serverReq = new CSServerReq()
            {
                Data = ByteString.AttachBytes(byteData), OpCode = opCodeType, Uid = StaticData.Uid
            };

            //序列化serverReq
            byte[] finalData = ProtoSerAndUnSer.Serialize(serverReq);
            StaticData.DebugGreen($"将要发送消息的消息入队:{msg.ToString()}");
            RequestItem item = new RequestItem()
            {
                msgData     = finalData,
                opCode      = opCodeType,
                onSuccess   = OnSuccess,
                onFail      = OnFail,
                isResponsed = false
            };

            QueueMsgBuiness.Enqueue(item);
        }
Beispiel #22
0
        internal OpCode(byte op1, byte op2,
                        Code code, FlowControl flowControl,
                        OpCodeType opCodeType, OperandType operandType,
                        StackBehaviour pop, StackBehaviour push)
        {
            m_value              = (short)((op1 << 8) | op2);
            m_code               = (byte)code;
            m_flowControl        = (byte)flowControl;
            m_opCodeType         = (byte)opCodeType;
            m_operandType        = (byte)operandType;
            m_stackBehaviourPop  = (byte)pop;
            m_stackBehaviourPush = (byte)push;

            if (op1 == 0xff)
            {
                OpCodes.OneByteOpCode [op2] = this;
            }
            else
            {
                OpCodes.TwoBytesOpCode [op2] = this;
            }
        }
Beispiel #23
0
 internal OpCode(string stringname,
                 StackBehaviour pop,
                 StackBehaviour push,
                 OperandType operand,
                 OpCodeType type,
                 int size,
                 byte s1,
                 byte s2,
                 FlowControl ctrl,
                 bool endsjmpblk,
                 int stack)
 {
     m_stringname       = stringname;
     m_pop              = pop;
     m_push             = push;
     m_operand          = operand;
     m_type             = type;
     m_size             = size;
     m_s1               = s1;
     m_s2               = s2;
     m_ctrl             = ctrl;
     m_endsUncondJmpBlk = endsjmpblk;
     m_stackChange      = stack;
 }
Beispiel #24
0
        public void SendCSAccept(CSAccept csaccept, Action <SCEmptyAccept> ResponseSCEmptyAcceptCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSAccept> ();

            ProtoSendMethod.BusinessRequest <SCEmptyAccept>(csaccept, opCodeType, ResponseSCEmptyAcceptCallBack, errorCallBack, isShowDefaultTip);
        }
Beispiel #25
0
        public void SendCSRepulse(CSRepulse csrepulse, Action <SCEmptyRepluse> ResponseSCEmptyRepluseCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSRepulse> ();

            ProtoSendMethod.BusinessRequest <SCEmptyRepluse>(csrepulse, opCodeType, ResponseSCEmptyRepluseCallBack, errorCallBack, isShowDefaultTip);
        }
Beispiel #26
0
        public void SendCSDelFriend(CSDelFriend csdelfriend, Action <SCEmtpyDelFriend> ResponseSCEmtpyDelFriendCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSDelFriend> ();

            ProtoSendMethod.BusinessRequest <SCEmtpyDelFriend>(csdelfriend, opCodeType, ResponseSCEmtpyDelFriendCallBack, errorCallBack, isShowDefaultTip);
        }
		internal OpCode (byte op1, byte op2,
			Code code, FlowControl flowControl,
			OpCodeType opCodeType, OperandType operandType,
			StackBehaviour pop, StackBehaviour push)
		{
			m_value = (short) ((op1 << 8) | op2);
			m_code = (byte) code;
			m_flowControl = (byte) flowControl;
			m_opCodeType = (byte) opCodeType;
			m_operandType = (byte) operandType;
			m_stackBehaviourPop = (byte) pop;
			m_stackBehaviourPush = (byte) push;

			if (op1 == 0xff)
				OpCodes.OneByteOpCode [op2] = this;
			else
				OpCodes.TwoBytesOpCode [op2] = this;
		}
Beispiel #28
0
    private bool VerificationHelper(OpCode code,
        string name,
        StackBehaviour pop,
        StackBehaviour push,
        OperandType oprandType,
        OpCodeType type,
        int size,
        byte s1,
        byte s2,
        FlowControl ctrl,
        string errorno,
        string errordesp)
    {
        bool retVal = true;

        string actualName = code.Name;
        if (actualName != name)
        {
            TestLibrary.TestFramework.LogError(errorno + ".0", "Name returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualName = " + actualName + ", name = " + name);
            retVal = false;
        }

        StackBehaviour actualPop = code.StackBehaviourPop;
        if (actualPop != pop)
        {
            TestLibrary.TestFramework.LogError(errorno + ".1", "StackBehaviourPop returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualPop = " + actualPop + ", pop = " + pop);
            retVal = false;
        }

        StackBehaviour actualPush = code.StackBehaviourPush;
        if (actualPush != push)
        {
            TestLibrary.TestFramework.LogError(errorno + ".2", "StackBehaviourPush returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualPush = " + actualPush + ", push = " + push);
            retVal = false;
        }

        OperandType actualOperandType = code.OperandType;
        if (actualOperandType != oprandType)
        {
            TestLibrary.TestFramework.LogError(errorno + ".3", "OperandType returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualOperandType = " + actualOperandType + ", oprandType = " + oprandType);
            retVal = false;
        }

        OpCodeType actualOpCodeType = code.OpCodeType;
        if (actualOpCodeType != type)
        {
            TestLibrary.TestFramework.LogError(errorno + ".4", "OpCodeType returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualOpCodeType = " + actualOpCodeType + ", type = " + type);
            retVal = false;
        }

        int actualSize = code.Size;
        if (actualSize != size)
        {
            TestLibrary.TestFramework.LogError(errorno + ".5", "Size returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualSize = " + actualSize + ", size = " + size);
            retVal = false;
        }

        short expectedValue = 0;
        if (size == 2)
            expectedValue = (short)(s1 << 8 | s2);
        else
            expectedValue = (short)s2;

        short actualValue = code.Value;
        if (actualValue != expectedValue)
        {
            TestLibrary.TestFramework.LogError(errorno + ".6", "Value returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualValue = " + actualValue + ", s1 = " + s1 + ", s2 = " + s2 + ", expectedValue = " + expectedValue);
            retVal = false;
        }

        FlowControl actualCtrl = code.FlowControl;
        if (actualCtrl != ctrl)
        {
            TestLibrary.TestFramework.LogError(errorno + ".7", "FlowControl returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualCtrl = " + actualCtrl + ", ctrl = " + ctrl);
            retVal = false;
        }
        return retVal;
    }
Beispiel #29
0
        public void SendCSEmptyOnceWatering(CSEmptyOnceWatering csemptyoncewatering, Action <SCOnceWatering> ResponseSCOnceWateringCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSEmptyOnceWatering> ();

            ProtoSendMethod.BusinessRequest <SCOnceWatering>(csemptyoncewatering, opCodeType, ResponseSCOnceWateringCallBack, errorCallBack, isShowDefaultTip);
        }
Beispiel #30
0
 internal OpCode(OpCodeValues value, int flags)
 {
     m_stringname = null; // computed lazily
     m_pop = (StackBehaviour)((flags >> StackBehaviourPopShift) & StackBehaviourMask);
     m_push = (StackBehaviour)((flags >> StackBehaviourPushShift) & StackBehaviourMask);
     m_operand = (OperandType)(flags & OperandTypeMask);
     m_type = (OpCodeType)((flags >> OpCodeTypeShift) & OpCodeTypeMask);
     m_size = (flags >> SizeShift) & SizeMask;
     m_s1 = (byte)((int)value >> 8);
     m_s2 = (byte)(int)value;
     m_ctrl = (FlowControl)((flags >> FlowControlShift) & FlowControlMask);
     m_endsUncondJmpBlk = (flags & EndsUncondJmpBlkFlag) != 0;
     m_stackChange = (flags >> StackChangeShift);
 }
Beispiel #31
0
        private void ProcessUnSeriMsgs(byte[] data)
        {
            var        unSeriMsgs = ProtoSerAndUnSer.UnSerialize <SCServerRes>(data);
            OpCodeType opCode     = unSeriMsgs.RtCode;

            StaticData.DebugGreen($"WebSocket Receive opCode:{opCode.ToString()}");
            IMessage msg = ListOPRelation.GetRealMessageByOpCodeType(opCode, unSeriMsgs.Data.ToByteArray());

            Debug.Log("ProcessUnSeriMsgs opCode = " + (int)opCode);
            Debug.Log("unSeriMsgs.Code = " + unSeriMsgs.Code);
            int code = (int)opCode;

            if (code >= 50000)
            {
                //账号被挤掉了
                switch (code)
                {
                case 50020:    //账户被挤掉
                    PushSystemAccountWasSqueezed();
                    break;

                case 60000:    //服务器强制更新
                    ServerForcedUpdate();
                    break;

                default:    //服务器推送
                    RigisterCmdPush.PushMsgHandle(msg, (int)opCode);
                    break;
                }
            }
            else
            {
                //判定队列中是否有,如果没有,直接丢弃
                if (QueueMsgBuiness.Count > 0)
                {
                    if (QueueMsgBuiness.Peek().opCode != opCode)
                    {
                        return;
                    }
                }

                if (QueueMsgBuiness.Count <= 0) //队列中没有东西,但是收到了返回
                {                               //重置
                    SetOnceMessageCompelete();
                    return;
                }

                //出队
                if (msg != null)
                {
                    StaticData.DebugGreen($"WebSocket msg:{msg.ToString()} Dequeue");
                }
                else
                {
                    StaticData.DebugGreen($"==========消息返回:{QueueMsgBuiness.Peek().opCode}为null!");
                }

                var msgItem = QueueMsgBuiness.Dequeue();
                SetOnceMessageCompelete();

                //正常请求
                if (unSeriMsgs.Code != (int)WebErrorCode.Success)
                {
                    ErrorInfo error = new ErrorInfo()
                    {
                        webErrorCode = (WebErrorCode)unSeriMsgs.Code, ErrorMessage = $"服务器异常{unSeriMsgs.Code}"
                    };
                    msgItem.onFail(error);
                }
                else
                {
                    msgItem.onSuccess((msg));
                }
            }
        }
Beispiel #32
0
 public Frame(OpCodeType op, byte[] d = null)
 {
     data   = d;
     opCode = op;
 }
Beispiel #33
0
 public Frame(string msg)
 {
     message = msg;
     opCode  = OpCodeType.Text;
 }
Beispiel #34
0
 public Frame(byte[] d)
 {
     data   = d;
     opCode = OpCodeType.Binary;
 }
Beispiel #35
0
    private bool VerifyAllTheFileds(OpCode opCode, 
                                    String opCodeName, 
                                    StackBehaviour pop, 
                                    StackBehaviour push, 
                                    OperandType operandType, 
                                    OpCodeType type, 
                                    int size, 
                                    byte s1, byte s2, 
                                    FlowControl ctrl, 
                                    string errorNum)
    {
        bool retVal = true;
        string errorDesc;

        string actualName = opCode.Name;
        if (actualName != opCodeName)
        {
            errorDesc = "Actual name of the specified MSIL instruction: \"" + actualName +
                        "\" does not equal expected name: \"" + opCodeName + "\"";
            TestLibrary.TestFramework.LogError( errorNum + ".1", errorDesc);
            retVal = false;
        }

        StackBehaviour actualStackBehaviourPop = opCode.StackBehaviourPop;
        if (actualStackBehaviourPop != pop)
        {
            errorDesc = "Actual pop statck behaviour of the specified MSIL instruction: (" + actualStackBehaviourPop +
                        ") does not equal expected pop stack behaviour: (" + pop + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".2", errorDesc);
            retVal = false;
        }

        StackBehaviour actualStackBehaviourPush = opCode.StackBehaviourPush;
        if (actualStackBehaviourPush != push)
        {
            errorDesc = "Actual push statck behaviour of the specified MSIL instruction: (" + actualStackBehaviourPush +
                        ") does not equal expected push stack behaviour: (" + push + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".3", errorDesc);
            retVal = false;
        }


        OperandType actualOperandType = opCode.OperandType;
        if (actualOperandType != operandType)
        {
            errorDesc = "Actual operand type of the specified MSIL instruction: (" + actualOperandType +
                        ") does not equal expected operand type: (" + operandType + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".4", errorDesc);
            retVal = false;
        }

        OpCodeType actualOpCodeType = opCode.OpCodeType;
        if (actualOpCodeType != type)
        {
            errorDesc = "Actual OpCode type of the specified MSIL instruction: (" + actualOpCodeType +
                        ") does not equal expected OpCode type: (" + type + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".5", errorDesc);
            retVal = false;
        }

        int actualSize = opCode.Size;
        if (actualSize != size)
        {
            errorDesc = "Actual size of the specified MSIL instruction: (" + actualSize +
                        ") does not equal expected size: (" + size + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".6", errorDesc);
            retVal = false;
        }

        short actualValue = opCode.Value;
        short expectedValue = (2 == size) ? (short)(s1 << 8 | s2) : s2;
        if (actualValue != expectedValue)
        {
            errorDesc = "Actual immediate operand value of the specified MSIL instruction: (" + actualValue +
                        ") does not equal expected immediate operand value: (" + expectedValue + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".7", errorDesc);
            retVal = false;
        }

        FlowControl actualCtrl = opCode.FlowControl;
        if (actualCtrl != ctrl)
        {
            errorDesc = "Actual flow control of the specified MSIL instruction: (" + actualCtrl +
                        ") does not equal expected flow control: (" + ctrl + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".8", errorDesc);
            retVal = false;
        }

        return retVal;
    }
Beispiel #36
0
    private bool VerifyAllTheFileds(OpCode opCode,
                                    String opCodeName,
                                    StackBehaviour pop,
                                    StackBehaviour push,
                                    OperandType operandType,
                                    OpCodeType type,
                                    int size,
                                    byte s1, byte s2,
                                    FlowControl ctrl,
                                    string errorNum)
    {
        bool   retVal = true;
        string errorDesc;

        string actualName = opCode.Name;

        if (actualName != opCodeName)
        {
            errorDesc = "Actual name of the specified MSIL instruction: \"" + actualName +
                        "\" does not equal expected name: \"" + opCodeName + "\"";
            TestLibrary.TestFramework.LogError(errorNum + ".1", errorDesc);
            retVal = false;
        }

        StackBehaviour actualStackBehaviourPop = opCode.StackBehaviourPop;

        if (actualStackBehaviourPop != pop)
        {
            errorDesc = "Actual pop statck behaviour of the specified MSIL instruction: (" + actualStackBehaviourPop +
                        ") does not equal expected pop stack behaviour: (" + pop + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".2", errorDesc);
            retVal = false;
        }

        StackBehaviour actualStackBehaviourPush = opCode.StackBehaviourPush;

        if (actualStackBehaviourPush != push)
        {
            errorDesc = "Actual push statck behaviour of the specified MSIL instruction: (" + actualStackBehaviourPush +
                        ") does not equal expected push stack behaviour: (" + push + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".3", errorDesc);
            retVal = false;
        }


        OperandType actualOperandType = opCode.OperandType;

        if (actualOperandType != operandType)
        {
            errorDesc = "Actual operand type of the specified MSIL instruction: (" + actualOperandType +
                        ") does not equal expected operand type: (" + operandType + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".4", errorDesc);
            retVal = false;
        }

        OpCodeType actualOpCodeType = opCode.OpCodeType;

        if (actualOpCodeType != type)
        {
            errorDesc = "Actual OpCode type of the specified MSIL instruction: (" + actualOpCodeType +
                        ") does not equal expected OpCode type: (" + type + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".5", errorDesc);
            retVal = false;
        }

        int actualSize = opCode.Size;

        if (actualSize != size)
        {
            errorDesc = "Actual size of the specified MSIL instruction: (" + actualSize +
                        ") does not equal expected size: (" + size + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".6", errorDesc);
            retVal = false;
        }

        short actualValue   = opCode.Value;
        short expectedValue = (2 == size) ? (short)(s1 << 8 | s2) : s2;

        if (actualValue != expectedValue)
        {
            errorDesc = "Actual immediate operand value of the specified MSIL instruction: (" + actualValue +
                        ") does not equal expected immediate operand value: (" + expectedValue + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".7", errorDesc);
            retVal = false;
        }

        FlowControl actualCtrl = opCode.FlowControl;

        if (actualCtrl != ctrl)
        {
            errorDesc = "Actual flow control of the specified MSIL instruction: (" + actualCtrl +
                        ") does not equal expected flow control: (" + ctrl + ")";
            TestLibrary.TestFramework.LogError(errorNum + ".8", errorDesc);
            retVal = false;
        }

        return(retVal);
    }
Beispiel #37
0
        public unsafe static string ByteCodeToString(OpCode *op, string split)
        {
            VirtualMachine *ptr    = *GameFunctions.GetThreadLocalStorage()->Jass.AsUnsafe()->VirtualMachine;
            string          text   = $"{split}0x{op->R1:X2}";
            OpCodeType      opType = op->OpType;

            if (opType == OpCodeType.GetArray)
            {
                text = $"{text}:{JassTypeToString((JassType)op->R1)}";
            }
            text = $"{text}{split}0x{op->R2:X2}";
            switch (op->OpType)
            {
            case OpCodeType.Literal:
            case OpCodeType.GetVar:
            case OpCodeType.Code:
                text = $"{text}:{JassTypeToString((JassType)op->R2)}";
                break;
            }
            text = $"{text}{split}0x{op->R2:X2}";
            switch (op->OpType)
            {
            case OpCodeType.Local:
            case OpCodeType.Global:
            case OpCodeType.Constant:
            case OpCodeType.PopFuncArg:
                text = $"{text}:{JassTypeToString((JassType)op->R3)}";
                break;
            }
            text = $"{text}{split}0x{(byte)op->OpType:X2}{split}{op->OpType}";
            switch (op->OpType)
            {
            case OpCodeType.Function:
            case OpCodeType.Local:
            case OpCodeType.Global:
            case OpCodeType.Constant:
            case OpCodeType.PopFuncArg:
            case OpCodeType.GetVar:
            case OpCodeType.GetArray:
            case OpCodeType.SetVar:
            case OpCodeType.SetArray:
            case OpCodeType.Native:
            case OpCodeType.JassCall:
                return(text + split + (*(ptr->SymbolTable->StringPool->Nodes + op->Argument * sizeof(StringNode *) / sizeof(StringNode *)))->Value);

            case OpCodeType.Literal:
                switch (op->R2)
                {
                case 5:
                    text = $"{text}{split}{Memory.Read<float>(new IntPtr(&op->Argument))}";
                    goto IL_2FC;

                case 6:
                    text = $"{text}{split}\"{(*(ptr->SymbolTable->StringPool->Nodes + op->Argument * sizeof(StringNode*) / sizeof(StringNode*)))->Value}\"";
                    goto IL_2FC;

                case 8:
                {
                    int argument = op->Argument;
                    if (argument != 0)
                    {
                        if (argument != 1)
                        {
                            text = $"{text}{split} = (boolean){argument}";
                        }
                        else
                        {
                            text = $"{text}{split} = true";
                        }
                    }
                    else
                    {
                        text = $"{text}{split} = false";
                    }
                    goto IL_2FC;
                }
                }
                text = $"{text}{split}{op->Argument}";
IL_2FC:
                return(text);
            }
            text = $"{text}{split}{op->Argument}";
            return(text);
        }
Beispiel #38
0
        public void SendCSDerectUp(CSDerectUp csderectup, Action <SCEmptyDerectUp> ResponseSCEmptyDerectUpCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSDerectUp> ();

            ProtoSendMethod.BusinessRequest <SCEmptyDerectUp>(csderectup, opCodeType, ResponseSCEmptyDerectUpCallBack, errorCallBack, isShowDefaultTip);
        }
        /// <summary>
        ///		Chooses the correct byte code based on the data type.
        /// </summary>
        /// <param name="type">Type to find operation code from.</param>
        /// <returns>The correct opcode based on the data type.</returns>
        private OpCode OpCodeByType(DataTypeValue type, OpCodeType opCodeType)
        {
            switch (opCodeType)
            {
                case OpCodeType.ALLOCATE_HEAP:
                    switch (type.DataType)
                    {
                        case DataType.Null: return OpCode.ALLOCATE_HEAP_NULL;
                        case DataType.Bool: return OpCode.ALLOCATE_HEAP_BOOL;
                        case DataType.Byte: return OpCode.ALLOCATE_HEAP_BYTE;
                        case DataType.Double: return OpCode.ALLOCATE_HEAP_DOUBLE;
                        case DataType.Object: return OpCode.ALLOCATE_HEAP_Object;
                        case DataType.Float: return OpCode.ALLOCATE_HEAP_FLOAT;
                        case DataType.Int: return OpCode.ALLOCATE_HEAP_INT;
                        case DataType.Long: return OpCode.ALLOCATE_HEAP_LONG;
                        case DataType.Short: return OpCode.ALLOCATE_HEAP_SHORT;
                        case DataType.String: return OpCode.ALLOCATE_HEAP_STRING;
                    }
                    break;
                case OpCodeType.CAST:
                    switch (type.DataType)
                    {
                        case DataType.Null: return OpCode.CAST_NULL;
                        case DataType.Bool: return OpCode.CAST_BOOL;
                        case DataType.Byte: return OpCode.CAST_BYTE;
                        case DataType.Double: return OpCode.CAST_DOUBLE;
                        case DataType.Object: return OpCode.CAST_Object;
                        case DataType.Float: return OpCode.CAST_FLOAT;
                        case DataType.Int: return OpCode.CAST_INT;
                        case DataType.Long: return OpCode.CAST_LONG;
                        case DataType.Short: return OpCode.CAST_SHORT;
                        case DataType.String: return OpCode.CAST_STRING;
                    }
                    break;
                case OpCodeType.CMP:

                    // If its an array or reference we need to compare the
                    // memory index not the value.
                    if (type.IsArray == true || type.IsReference == true)
                    {
                        return OpCode.CMP_MEMORY_INDEX;
                    }

                    switch (type.DataType)
                    {
                        case DataType.Null: return OpCode.CMP_NULL;
                        case DataType.Bool: return OpCode.CMP_BOOL;
                        case DataType.Byte: return OpCode.CMP_BYTE;
                        case DataType.Double: return OpCode.CMP_DOUBLE;
                        case DataType.Object: return OpCode.CMP_Object;
                        case DataType.Float: return OpCode.CMP_FLOAT;
                        case DataType.Int: return OpCode.CMP_INT;
                        case DataType.Long: return OpCode.CMP_LONG;
                        case DataType.Short: return OpCode.CMP_SHORT;
                        case DataType.String: return OpCode.CMP_STRING;
                    }
                    break;
                case OpCodeType.PUSH:

                    // If its an array or reference we need to push the
                    // memory index not the value.
                    if (type.IsArray == true || type.IsReference == true)
                    {
                        return OpCode.PUSH_MEMORY_INDEX;
                    }

                    switch (type.DataType)
                    {
                        case DataType.Null: return OpCode.PUSH_NULL;
                        case DataType.Bool: return OpCode.PUSH_BOOL;
                        case DataType.Byte: return OpCode.PUSH_BYTE;
                        case DataType.Double: return OpCode.PUSH_DOUBLE;
                        case DataType.Object: return OpCode.PUSH_OBJECT;
                        case DataType.Float: return OpCode.PUSH_FLOAT;
                        case DataType.Int: return OpCode.PUSH_INT;
                        case DataType.Long: return OpCode.PUSH_LONG;
                        case DataType.Short: return OpCode.PUSH_SHORT;
                        case DataType.String: return OpCode.PUSH_STRING;
                    }
                    break;
                case OpCodeType.POP:

                    // If its an array or reference we need to pop the
                    // memory index not the value.
                    if (type.IsArray == true || type.IsReference == true)
                    {
                        return OpCode.POP_MEMORY_INDEX;
                    }

                    switch (type.DataType)
                    {
                        case DataType.Null: return OpCode.POP_NULL;
                        case DataType.Bool: return OpCode.POP_BOOL;
                        case DataType.Byte: return OpCode.POP_BYTE;
                        case DataType.Double: return OpCode.POP_DOUBLE;
                        case DataType.Object: return OpCode.POP_OBJECT;
                        case DataType.Float: return OpCode.POP_FLOAT;
                        case DataType.Int: return OpCode.POP_INT;
                        case DataType.Long: return OpCode.POP_LONG;
                        case DataType.Short: return OpCode.POP_SHORT;
                        case DataType.String: return OpCode.POP_STRING;
                    }
                    break;
                case OpCodeType.MOV:

                    // If its an array or reference we need to move the
                    // memory index not the value.
                    if (type.IsArray == true || type.IsReference == true)
                    {
                        return OpCode.MOV_MEMORY_INDEX;
                    }

                    switch (type.DataType)
                    {
                        case DataType.Bool: return OpCode.MOV_BOOL;
                        case DataType.Byte: return OpCode.MOV_BYTE;
                        case DataType.Double: return OpCode.MOV_DOUBLE;
                        case DataType.Object: return OpCode.MOV_OBJECT;
                        case DataType.Null: return OpCode.MOV_NULL;
                        case DataType.Float: return OpCode.MOV_FLOAT;
                        case DataType.Int: return OpCode.MOV_INT;
                        case DataType.Long: return OpCode.MOV_LONG;
                        case DataType.Short: return OpCode.MOV_SHORT;
                        case DataType.String: return OpCode.MOV_STRING;
                    }
                    break;
                case OpCodeType.MUL:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.MUL_BYTE;
                        case DataType.Double: return OpCode.MUL_DOUBLE;
                        case DataType.Float: return OpCode.MUL_FLOAT;
                        case DataType.Int: return OpCode.MUL_INT;
                        case DataType.Long: return OpCode.MUL_LONG;
                        case DataType.Short: return OpCode.MUL_SHORT;
                    }
                    break;
                case OpCodeType.DIV:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.DIV_BYTE;
                        case DataType.Double: return OpCode.DIV_DOUBLE;
                        case DataType.Float: return OpCode.DIV_FLOAT;
                        case DataType.Int: return OpCode.DIV_INT;
                        case DataType.Long: return OpCode.DIV_LONG;
                        case DataType.Short: return OpCode.DIV_SHORT;
                    }
                    break;
                case OpCodeType.ADD:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.ADD_BYTE;
                        case DataType.Double: return OpCode.ADD_DOUBLE;
                        case DataType.Float: return OpCode.ADD_FLOAT;
                        case DataType.Int: return OpCode.ADD_INT;
                        case DataType.Long: return OpCode.ADD_LONG;
                        case DataType.Short: return OpCode.ADD_SHORT;
                        case DataType.String: return OpCode.ADD_STRING;
                    }
                    break;
                case OpCodeType.SUB:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.SUB_BYTE;
                        case DataType.Double: return OpCode.SUB_DOUBLE;
                        case DataType.Float: return OpCode.SUB_FLOAT;
                        case DataType.Int: return OpCode.SUB_INT;
                        case DataType.Long: return OpCode.SUB_LONG;
                        case DataType.Short: return OpCode.SUB_SHORT;
                    }
                    break;
                case OpCodeType.INC:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.INC_BYTE;
                        case DataType.Double: return OpCode.INC_DOUBLE;
                        case DataType.Float: return OpCode.INC_FLOAT;
                        case DataType.Int: return OpCode.INC_INT;
                        case DataType.Long: return OpCode.INC_LONG;
                        case DataType.Short: return OpCode.INC_SHORT;
                    }
                    break;
                case OpCodeType.DEC:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.DEC_BYTE;
                        case DataType.Double: return OpCode.DEC_DOUBLE;
                        case DataType.Float: return OpCode.DEC_FLOAT;
                        case DataType.Int: return OpCode.DEC_INT;
                        case DataType.Long: return OpCode.DEC_LONG;
                        case DataType.Short: return OpCode.DEC_SHORT;
                    }
                    break;
                case OpCodeType.NEG:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.NEG_BYTE;
                        case DataType.Double: return OpCode.NEG_DOUBLE;
                        case DataType.Float: return OpCode.NEG_FLOAT;
                        case DataType.Int: return OpCode.NEG_INT;
                        case DataType.Long: return OpCode.NEG_LONG;
                        case DataType.Short: return OpCode.NEG_SHORT;
                    }
                    break;
                case OpCodeType.ABS:
                    switch (type.DataType)
                    {
                        case DataType.Byte: return OpCode.ABS_BYTE;
                        case DataType.Double: return OpCode.ABS_DOUBLE;
                        case DataType.Float: return OpCode.ABS_FLOAT;
                        case DataType.Int: return OpCode.ABS_INT;
                        case DataType.Long: return OpCode.ABS_LONG;
                        case DataType.Short: return OpCode.ABS_SHORT;
                    }
                    break;
            }
            return OpCode.INVALID;
        }
Beispiel #40
0
    private bool VerificationHelper(OpCode code,
                                    string name,
                                    StackBehaviour pop,
                                    StackBehaviour push,
                                    OperandType oprandType,
                                    OpCodeType type,
                                    int size,
                                    byte s1,
                                    byte s2,
                                    FlowControl ctrl,
                                    string errorno,
                                    string errordesp)
    {
        bool retVal = true;

        string actualName = code.Name;

        if (actualName != name)
        {
            TestLibrary.TestFramework.LogError(errorno + ".0", "Name returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualName = " + actualName + ", name = " + name);
            retVal = false;
        }

        StackBehaviour actualPop = code.StackBehaviourPop;

        if (actualPop != pop)
        {
            TestLibrary.TestFramework.LogError(errorno + ".1", "StackBehaviourPop returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualPop = " + actualPop + ", pop = " + pop);
            retVal = false;
        }

        StackBehaviour actualPush = code.StackBehaviourPush;

        if (actualPush != push)
        {
            TestLibrary.TestFramework.LogError(errorno + ".2", "StackBehaviourPush returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualPush = " + actualPush + ", push = " + push);
            retVal = false;
        }

        OperandType actualOperandType = code.OperandType;

        if (actualOperandType != oprandType)
        {
            TestLibrary.TestFramework.LogError(errorno + ".3", "OperandType returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualOperandType = " + actualOperandType + ", oprandType = " + oprandType);
            retVal = false;
        }

        OpCodeType actualOpCodeType = code.OpCodeType;

        if (actualOpCodeType != type)
        {
            TestLibrary.TestFramework.LogError(errorno + ".4", "OpCodeType returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualOpCodeType = " + actualOpCodeType + ", type = " + type);
            retVal = false;
        }

        int actualSize = code.Size;

        if (actualSize != size)
        {
            TestLibrary.TestFramework.LogError(errorno + ".5", "Size returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualSize = " + actualSize + ", size = " + size);
            retVal = false;
        }

        short expectedValue = 0;

        if (size == 2)
        {
            expectedValue = (short)(s1 << 8 | s2);
        }
        else
        {
            expectedValue = (short)s2;
        }

        short actualValue = code.Value;

        if (actualValue != expectedValue)
        {
            TestLibrary.TestFramework.LogError(errorno + ".6", "Value returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualValue = " + actualValue + ", s1 = " + s1 + ", s2 = " + s2 + ", expectedValue = " + expectedValue);
            retVal = false;
        }

        FlowControl actualCtrl = code.FlowControl;

        if (actualCtrl != ctrl)
        {
            TestLibrary.TestFramework.LogError(errorno + ".7", "FlowControl returns wrong value for OpCode " + errordesp);
            TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actualCtrl = " + actualCtrl + ", ctrl = " + ctrl);
            retVal = false;
        }
        return(retVal);
    }
Beispiel #41
0
        public void SendCSEnterMap(CSEnterMap csentermap, Action <SCSearch> ResponseSCSearchCallBack, Action <ErrorInfo> errorCallBack, bool isShowDefaultTip = true)
        {
            OpCodeType opCodeType = ListOPRelation.GetOpCodeTypeByRequest <CSEnterMap> ();

            ProtoSendMethod.BusinessRequest <SCSearch>(csentermap, opCodeType, ResponseSCSearchCallBack, errorCallBack, isShowDefaultTip);
        }
Beispiel #42
0
 internal OneByteOpCode(
     Code code, OpCodeType opCodeType, OperandType operandType,
     FlowControl flowControl, StackBehaviour pop, StackBehaviour push)
     : base(code, opCodeType, operandType, flowControl, pop, push)
 {
 }
Beispiel #43
0
        public static IMessage GetRealMessageByOpCodeType(OpCodeType codeType, byte[] data)
        {
            if ((int)codeType == 1)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCLinkInfo>(data));
            }
            if ((int)codeType == 2)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCUserInfo>(data));
            }
            if ((int)codeType == 3)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpySetBasicsInfo>(data));
            }
            if ((int)codeType == 5)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendList>(data));
            }
            if ((int)codeType == 6)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCApplyList>(data));
            }
            if ((int)codeType == 7)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCRecommendList>(data));
            }
            if ((int)codeType == 8)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyApply>(data));
            }
            if ((int)codeType == 9)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyAccept>(data));
            }
            if ((int)codeType == 10)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyRepluse>(data));
            }
            if ((int)codeType == 11)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyDelFriend>(data));
            }
            if ((int)codeType == 12)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCSearch>(data));
            }
            if ((int)codeType == 13)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCSearch>(data));
            }
            if ((int)codeType == 14)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCDiceResult>(data));
            }
            if ((int)codeType == 15)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyRichManFinish>(data));
            }
            if ((int)codeType == 16)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCLucky>(data));
            }
            if ((int)codeType == 17)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyCropSpeed>(data));
            }
            if ((int)codeType == 18)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCBuyProp>(data));
            }
            if ((int)codeType == 19)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCDrag>(data));
            }
            if ((int)codeType == 20)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCManorData>(data));
            }
            if ((int)codeType == 21)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptFertilizer>(data));
            }
            if ((int)codeType == 22)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptEradicate>(data));
            }
            if ((int)codeType == 23)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCPlantResult>(data));
            }
            if ((int)codeType == 24)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCHarvestData>(data));
            }
            if ((int)codeType == 25)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCStealData>(data));
            }
            if ((int)codeType == 26)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptChangeLocationData>(data));
            }
            if ((int)codeType == 27)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCGoodSellData>(data));
            }
            if ((int)codeType == 28)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptGoodLock>(data));
            }
            if ((int)codeType == 29)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCManorFriendData>(data));
            }
            if ((int)codeType == 30)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCUnlockArea>(data));
            }
            if ((int)codeType == 31)
            {
                return(ProtoSerAndUnSer.UnSerialize <CSRoleSInfo>(data));
            }
            if ((int)codeType == 32)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptChoiceRole>(data));
            }
            if ((int)codeType == 33)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCBuyProp>(data));
            }
            if ((int)codeType == 34)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCPromotionsGoodsInfo>(data));
            }
            if ((int)codeType == 35)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCGoldJewelBuy>(data));
            }
            if ((int)codeType == 36)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCBuySection>(data));
            }
            if ((int)codeType == 37)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyClearance>(data));
            }
            if ((int)codeType == 38)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyOrnamentalRecycle>(data));
            }
            if ((int)codeType == 39)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCTreasureChestResult>(data));
            }
            if ((int)codeType == 40)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCGetTreasureChestAwardResult>(data));
            }
            if ((int)codeType == 43)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCBuyExtraStory>(data));
            }
            if ((int)codeType == 44)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCMailInfo>(data));
            }
            if ((int)codeType == 45)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCAccessoryInWarehouse>(data));
            }
            if ((int)codeType == 46)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCAccessory>(data));
            }
            if ((int)codeType == 47)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEverydayAward>(data));
            }
            if ((int)codeType == 49)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendStealInfo>(data));
            }
            if ((int)codeType == 50)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCCurrentExperience>(data));
            }
            if ((int)codeType == 53)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCWorkShedSpeedUp>(data));
            }
            if ((int)codeType == 54)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCTreasureChestUnlockInfo>(data));
            }
            if ((int)codeType == 55)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCTreasureChestSpeed>(data));
            }
            if ((int)codeType == 56)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCUseWarehouseGoods>(data));
            }
            if ((int)codeType == 57)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCManorLogs>(data));
            }
            if ((int)codeType == 58)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCPurchaseRole>(data));
            }
            if ((int)codeType == 59)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptySwitchoverRole>(data));
            }
            if ((int)codeType == 60)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptySwitchoverCostume>(data));
            }
            if ((int)codeType == 61)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCOneselfMarmot>(data));
            }
            if ((int)codeType == 62)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendMarmot>(data));
            }
            if ((int)codeType == 63)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyAdvExtraStory>(data));
            }
            if ((int)codeType == 64)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyWorldChat>(data));
            }
            if ((int)codeType == 65)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyPrivateChat>(data));
            }
            if ((int)codeType == 66)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEntranceRoom>(data));
            }
            if ((int)codeType == 67)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyGuessing>(data));
            }
            if ((int)codeType == 68)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyChannelChat>(data));
            }
            if ((int)codeType == 69)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCRoomListInfo>(data));
            }
            if ((int)codeType == 70)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyLoginGetFavorable>(data));
            }
            if ((int)codeType == 71)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptySendNPCGift>(data));
            }
            if ((int)codeType == 72)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpySectionAddFavorable>(data));
            }
            if ((int)codeType == 74)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFavorableInfo>(data));
            }
            if ((int)codeType == 75)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyMoveLocation>(data));
            }
            if ((int)codeType == 76)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyDepartureRoom>(data));
            }
            if ((int)codeType == 78)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyMotion>(data));
            }
            if ((int)codeType == 79)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCMarmotAwardInfo>(data));
            }
            if ((int)codeType == 80)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyChangeMailState>(data));
            }
            if ((int)codeType == 81)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCBuyProp>(data));
            }
            if ((int)codeType == 82)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyHeartBeat>(data));
            }
            if ((int)codeType == 83)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyAccumulateSignIn>(data));
            }
            if ((int)codeType == 84)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptySaveGuidance>(data));
            }
            if ((int)codeType == 87)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCManorGuidance>(data));
            }
            if ((int)codeType == 88)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCStealManorGuidance>(data));
            }
            if ((int)codeType == 91)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCGetTaskInfo>(data));
            }
            if ((int)codeType == 92)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCGetTaskAward>(data));
            }
            if ((int)codeType == 93)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyLogoutAccount>(data));
            }
            if ((int)codeType == 94)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCCdkAward>(data));
            }
            if ((int)codeType == 95)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCDealInfo>(data));
            }
            if ((int)codeType == 96)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCSubmintDeal>(data));
            }
            if ((int)codeType == 97)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCRefreshDeal>(data));
            }
            if ((int)codeType == 98)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyAdvSkipDeal>(data));
            }
            if ((int)codeType == 99)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyEntranceSection>(data));
            }
            if ((int)codeType == 100)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCCropMature>(data));
            }
            if ((int)codeType == 101)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyManorDecorateRotate>(data));
            }
            if ((int)codeType == 102)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyLike>(data));
            }
            if ((int)codeType == 103)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendCostume>(data));
            }
            if ((int)codeType == 104)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCOnceWatering>(data));
            }
            if ((int)codeType == 105)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyDerectUp>(data));
            }
            if ((int)codeType == 50002)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendApplyPushMsg>(data));
            }
            if ((int)codeType == 50003)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendAcceptPushMsg>(data));
            }
            if ((int)codeType == 50004)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendRepulsePushMsg>(data));
            }
            if ((int)codeType == 50005)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCFriendDeletePushMsg>(data));
            }
            if ((int)codeType == 50006)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCSendMailPushMsg>(data));
            }
            if ((int)codeType == 50009)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCNotePushMess>(data));
            }
            if ((int)codeType == 50010)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCNotePushMess>(data));
            }
            if ((int)codeType == 50011)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCChat>(data));
            }
            if ((int)codeType == 50012)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCChat>(data));
            }
            if ((int)codeType == 50013)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCChat>(data));
            }
            if ((int)codeType == 50014)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEntranceRoomInfo>(data));
            }
            if ((int)codeType == 50015)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCMoveLocation>(data));
            }
            if ((int)codeType == 50016)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCpushGuessingInfo>(data));
            }
            if ((int)codeType == 50017)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCpushMotion>(data));
            }
            if ((int)codeType == 50018)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCDepartureRoom>(data));
            }
            if ((int)codeType == 50019)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCActivityFinish>(data));
            }
            if ((int)codeType == 50020)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCRepetitionRegister>(data));
            }
            if ((int)codeType == 50021)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmtpyMailPushMsg>(data));
            }
            if ((int)codeType == 60000)
            {
                return(ProtoSerAndUnSer.UnSerialize <SCEmptyCoerceRenewal>(data));
            }

            return(null);
        }