Esempio n. 1
0
        protected override string GetInstructionTextInternal()
        {
            var str = new StringBuilder();

            str.Append(OpCode.ToString());
            str.Append(" ");

            bool first = true;

            foreach (var item in SwitchTable)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    str.Append(", ");
                }

                str.Append(LiteralFormatter.FormatInteger(item.Key));
                str.Append("->@");
                str.Append(string.Format("{0:x}", item.Value));
            }

            return(str.ToString());
        }
Esempio n. 2
0
        protected virtual string GetInstructionTextInternal()
        {
            var str = new StringBuilder();

            if (!Enum.IsDefined(typeof(OpCode), OpCode))
            {
                str.Append("Unknown_");
                str.Append((int)OpCode);
            }
            else
            {
                str.Append(OpCode);
            }

            for (int i = 0; i < OperandCount; i++)
            {
                str.Append(i > 0 ? ", " : " ");

                object opValue = Operands[i];
                Type   opType  = opValue.GetType();
                string opName  = GetOperandName(i);

                if (opName != null)
                {
                    str.Append(opName);
                    str.Append("=");
                }

                if (opType == typeof(string))
                {
                    str.Append(LiteralFormatter.FormatString(opValue.ToString()));
                }
                else if (opType == typeof(uint))
                {
                    str.Append(LiteralFormatter.FormatInteger((int)(uint)opValue));
                }
                else if (opType == typeof(int))
                {
                    str.Append(LiteralFormatter.FormatInteger((int)opValue));
                }
                else if (opType == typeof(float))
                {
                    str.Append(LiteralFormatter.FormatFloat((float)opValue));
                }
                else
                {
                    str.Append(opValue.ToString());
                }
            }

            return(str.ToString());
        }