private void WriteOpCode(ILOpCode opCode)
        {
            var    opCodeInfo = new OpCodeInfo(opCode, opCode.GetDisplayName());
            string index;

            switch (opCode)
            {
            case ILOpCode.Ldarg_0:
            case ILOpCode.Ldarg_1:
            case ILOpCode.Ldarg_2:
            case ILOpCode.Ldarg_3:
                output.WriteReference(opCodeInfo, omitSuffix: true);
                index = opCodeInfo.Name.Substring(6);
                output.WriteLocalReference(index, "param_" + index);
                break;

            case ILOpCode.Ldloc_0:
            case ILOpCode.Ldloc_1:
            case ILOpCode.Ldloc_2:
            case ILOpCode.Ldloc_3:
            case ILOpCode.Stloc_0:
            case ILOpCode.Stloc_1:
            case ILOpCode.Stloc_2:
            case ILOpCode.Stloc_3:
                output.WriteReference(opCodeInfo, omitSuffix: true);
                index = opCodeInfo.Name.Substring(6);
                output.WriteLocalReference(index, "loc_" + index);
                break;

            default:
                output.WriteReference(opCodeInfo);
                break;
            }
        }
Exemplo n.º 2
0
 public void WriteReference(Disassembler.OpCodeInfo opCode, bool omitSuffix = false)
 {
     if (omitSuffix)
     {
         int lastDot = opCode.Name.LastIndexOf('.');
         if (lastDot > 0)
         {
             Write(opCode.Name.Remove(lastDot + 1));
         }
     }
     else
     {
         Write(opCode.Name);
     }
 }