当前位置: 首页>>代码示例>>C#>>正文


C# IOperation.ToString方法代码示例

本文整理汇总了C#中IOperation.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IOperation.ToString方法的具体用法?C# IOperation.ToString怎么用?C# IOperation.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOperation的用法示例。


在下文中一共展示了IOperation.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getSizeOfOpcodeArgument


//.........这里部分代码省略.........
                case OperationCode.Br_S:
                case OperationCode.Brfalse_S:
                case OperationCode.Brtrue_S:
                case OperationCode.Ldarg_S:
                case OperationCode.Ldarga_S:
                case OperationCode.Ldc_I4_S:
                case OperationCode.Ldloc_S:
                case OperationCode.Ldloca_S:
                case OperationCode.Leave_S:
                case OperationCode.Starg_S:
                case OperationCode.Stloc_S:
                    return 1;

                // instructions with 2 byte argument
                case OperationCode.Ldarg:
                case OperationCode.Ldarga:
                case OperationCode.Ldloc:
                case OperationCode.Ldloca:
                case OperationCode.Starg:
                case OperationCode.Stloc:
                    return 2;

                // instructions with 4 byte argument
                case OperationCode.Beq:
                case OperationCode.Bge:
                case OperationCode.Bge_Un:
                case OperationCode.Bgt:
                case OperationCode.Bgt_Un:
                case OperationCode.Ble:
                case OperationCode.Ble_Un:
                case OperationCode.Blt:
                case OperationCode.Blt_Un:
                case OperationCode.Bne_Un:
                case OperationCode.Box:
                case OperationCode.Br:
                case OperationCode.Brfalse:
                case OperationCode.Brtrue:
                case OperationCode.Call:
                case OperationCode.Callvirt:
                case OperationCode.Castclass:
                case OperationCode.Constrained_:
                case OperationCode.Cpobj:
                case OperationCode.Initobj:
                case OperationCode.Isinst:
                case OperationCode.Jmp:
                case OperationCode.Ldc_I4:
                case OperationCode.Ldc_R4:
                case OperationCode.Ldelem:
                case OperationCode.Ldelema:
                case OperationCode.Ldfld:
                case OperationCode.Ldflda:
                case OperationCode.Ldftn:
                case OperationCode.Ldobj:
                case OperationCode.Ldsfld:
                case OperationCode.Ldsflda:
                case OperationCode.Ldstr:
                case OperationCode.Ldtoken:
                case OperationCode.Ldvirtftn:
                case OperationCode.Leave:
                case OperationCode.Mkrefany:
                case OperationCode.Newarr:
                case OperationCode.Newobj:
                case OperationCode.Sizeof:
                case OperationCode.Stelem:
                case OperationCode.Stobj:
                case OperationCode.Stfld:
                case OperationCode.Stsfld:
                case OperationCode.Unbox_Any:
                    return 4;

                // instructions with 8 byte argument
                case OperationCode.Ldc_I8:
                case OperationCode.Ldc_R8:
                    return 8;

                // switch is a special case with variable byte length
                case OperationCode.Switch:

                    // switch has one argument with 4 bytes which gives the count
                    // of the jump targets
                    uint tempSize = 4;

                    // each jump target offset uses a 4 byte value
                    tempSize += (uint)((uint[])operation.Value).Count() * 4;

                    return tempSize;

                // argument size unknown
                default:
                    throw new ArgumentException("Do not know how to handle size of " + operation.ToString() + " instruction.");
            }

            /* TODO
             * cases not implemented yet:
                   calli                                      
                   ldfsflda                                                                                              
                   refanyval
                   unbox
             */
        }
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:101,代码来源:Cfg.cs


注:本文中的IOperation.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。