本文整理汇总了C#中de4dot.code.renamer.asmmodules.MethodDef类的典型用法代码示例。如果您正苦于以下问题:C# MethodDef类的具体用法?C# MethodDef怎么用?C# MethodDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodDef类属于de4dot.code.renamer.asmmodules命名空间,在下文中一共展示了MethodDef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: addMethod
// Returns the previous method, or null if none
public MethodDef addMethod(MethodDef ifaceMethod, MethodDef classMethod)
{
if (!ifaceMethodToClassMethod.ContainsKey(ifaceMethod))
throw new ApplicationException("Could not find interface method");
MethodDef oldMethod;
ifaceMethodToClassMethod.TryGetValue(ifaceMethod, out oldMethod);
ifaceMethodToClassMethod[ifaceMethod] = classMethod;
return oldMethod;
}
开发者ID:Perplexity,项目名称:de4dot,代码行数:11,代码来源:TypeDef.cs
示例2: MMethodDef
public MMethodDef(MethodDef methodDef, MTypeDef owner, int index)
: base(methodDef, owner, index) {
genericParams = MGenericParamDef.CreateGenericParamDefList(MethodDef.GenericParameters);
visibleBaseIndex = methodDef.MethodSig != null && methodDef.MethodSig.HasThis ? 1 : 0;
for (int i = 0; i < methodDef.Parameters.Count; i++) {
var param = methodDef.Parameters[i];
if (param.IsNormalMethodParameter)
visibleParamCount++;
paramDefs.Add(new MParamDef(param, i));
}
returnParamDef = new MParamDef(methodDef.Parameters.ReturnParameter, -1);
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:12,代码来源:MethodDef.cs
示例3: getOverriddenEvent
EventDef getOverriddenEvent(MethodDef overrideMethod, out MethodDef overriddenMethod)
{
var theMethod = overrideMethod.MethodDefinition.Overrides[0];
overriddenMethod = modules.resolve(theMethod);
if (overriddenMethod != null)
return overriddenMethod.Event;
var extType = theMethod.DeclaringType;
if (extType == null)
return null;
var extTypeDef = modules.resolveOther(extType);
if (extTypeDef == null)
return null;
overriddenMethod = extTypeDef.find(theMethod);
if (overriddenMethod != null)
return overriddenMethod.Event;
return null;
}
开发者ID:Joelone,项目名称:de4dot,代码行数:19,代码来源:Renamer.cs
示例4: same
public void same(MethodDef a, MethodDef b)
{
merge(get(a), get(b));
}
开发者ID:Perplexity,项目名称:de4dot,代码行数:4,代码来源:MethodNameScopes.cs
示例5: add
public void add(MethodDef methodDef)
{
get(methodDef);
}
开发者ID:Perplexity,项目名称:de4dot,代码行数:4,代码来源:MethodNameScopes.cs
示例6: MethodInst
public MethodInst(MethodDef origMethodDef, MethodReference methodReference)
{
this.origMethodDef = origMethodDef;
this.methodReference = methodReference;
}
开发者ID:Perplexity,项目名称:de4dot,代码行数:5,代码来源:TypeDef.cs
示例7: CreatePropertySig
static PropertySig CreatePropertySig(MethodDef method, TypeSig propType, bool isGetter) {
if (method == null)
return null;
var sig = method.MethodSig;
if (sig == null)
return null;
var newSig = new PropertySig(sig.HasThis, propType);
newSig.GenParamCount = sig.GenParamCount;
int count = sig.Params.Count;
if (!isGetter)
count--;
for (int i = 0; i < count; i++)
newSig.Params.Add(sig.Params[i]);
return newSig;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:18,代码来源:Renamer.cs
示例8: findInitializeComponentMethod
void findInitializeComponentMethod(TypeDef type, MethodDef possibleInitMethod)
{
foreach (var methodDef in type.AllMethods) {
if (methodDef.MethodDefinition.Name != ".ctor")
continue;
if (methodDef.MethodDefinition.Body == null)
continue;
foreach (var instr in methodDef.MethodDefinition.Body.Instructions) {
if (instr.OpCode.Code != Code.Call && instr.OpCode.Code != Code.Callvirt)
continue;
if (!MemberReferenceHelper.compareMethodReferenceAndDeclaringType(possibleInitMethod.MethodDefinition, instr.Operand as MethodReference))
continue;
memberInfos.method(possibleInitMethod).suggestedName = "InitializeComponent";
return;
}
}
}
开发者ID:huliang,项目名称:de4dot,代码行数:18,代码来源:TypeInfo.cs
示例9: canRenameMethod
bool canRenameMethod(MethodDef methodDef)
{
var methodInfo = method(methodDef);
if (methodDef.isStatic()) {
if (methodInfo.oldName == ".cctor")
return false;
}
else if (methodDef.isVirtual()) {
if (DotNetUtils.derivesFromDelegate(type.TypeDefinition)) {
switch (methodInfo.oldName) {
case "BeginInvoke":
case "EndInvoke":
case "Invoke":
return false;
}
}
}
else {
if (methodInfo.oldName == ".ctor")
return false;
}
return true;
}
开发者ID:huliang,项目名称:de4dot,代码行数:23,代码来源:TypeInfo.cs
示例10: isEventHandler
static bool isEventHandler(MethodDef methodDef)
{
if (methodDef.MethodDefinition.Parameters.Count != 2)
return false;
if (methodDef.MethodDefinition.MethodReturnType.ReturnType.FullName != "System.Void")
return false;
if (methodDef.MethodDefinition.Parameters[0].ParameterType.FullName != "System.Object")
return false;
if (!methodDef.MethodDefinition.Parameters[1].ParameterType.FullName.Contains("EventArgs"))
return false;
return true;
}
开发者ID:huliang,项目名称:de4dot,代码行数:12,代码来源:TypeInfo.cs
示例11: renameMethod
public void renameMethod(MethodDef methodDef, string methodName)
{
if (!canRenameMethod(methodDef))
return;
var methodInfo = method(methodDef);
variableNameState.addMethodName(methodName);
methodInfo.rename(methodName);
}
开发者ID:huliang,项目名称:de4dot,代码行数:8,代码来源:TypeInfo.cs
示例12: method
public MethodInfo method(MethodDef method)
{
return memberInfos.method(method);
}
开发者ID:huliang,项目名称:de4dot,代码行数:4,代码来源:TypeInfo.cs
示例13: getOverriddenProperty
PropertyDef getOverriddenProperty(MethodDef overrideMethod)
{
var theMethod = overrideMethod.MethodDefinition.Overrides[0];
var overriddenMethod = modules.resolve(theMethod);
if (overriddenMethod != null)
return overriddenMethod.Property;
var extType = theMethod.DeclaringType;
if (extType == null)
return null;
var extTypeDef = modules.resolveOther(extType);
if (extTypeDef == null)
return null;
var theMethodDef = extTypeDef.find(theMethod);
if (theMethodDef != null)
return theMethodDef.Property;
return null;
}
开发者ID:Joelone,项目名称:de4dot,代码行数:19,代码来源:Renamer.cs
示例14: getOverriddenMethod
MethodDef getOverriddenMethod(MethodDef overrideMethod)
{
return modules.resolve(overrideMethod.MethodDefinition.Overrides[0]);
}
开发者ID:Joelone,项目名称:de4dot,代码行数:4,代码来源:Renamer.cs
示例15: get
public MethodNameGroup get(MethodDef method)
{
if (!method.isVirtual())
throw new ApplicationException("Not a virtual method");
MethodNameGroup group;
if (!methodGroups.TryGetValue(method, out group)) {
methodGroups[method] = group = new MethodNameGroup();
group.add(method);
}
return group;
}
开发者ID:Joelone,项目名称:de4dot,代码行数:11,代码来源:MethodNameGroups.cs
示例16: CreateProperty
MPropertyDef CreateProperty(MTypeDef ownerType, string name, TypeSig propType, MethodDef getter, MethodDef setter) {
if (string.IsNullOrEmpty(name) || propType.ElementType == ElementType.Void)
return null;
var newSig = CreatePropertySig(getter, propType, true) ?? CreatePropertySig(setter, propType, false);
if (newSig == null)
return null;
var newProp = ownerType.Module.ModuleDefMD.UpdateRowId(new PropertyDefUser(name, newSig, 0));
newProp.GetMethod = getter;
newProp.SetMethod = setter;
var propDef = ownerType.FindAny(newProp);
if (propDef != null)
return propDef;
propDef = ownerType.Create(newProp);
memberInfos.Add(propDef);
if (isVerbose)
Logger.v("Restoring property: {0}", Utils.RemoveNewlines(newProp));
return propDef;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:19,代码来源:Renamer.cs
示例17: getPinvokeName
string getPinvokeName(MethodDef methodDef)
{
var entryPoint = methodDef.MethodDefinition.PInvokeInfo.EntryPoint;
if (Regex.IsMatch(entryPoint, @"^#\d+$"))
entryPoint = DotNetUtils.getDllName(methodDef.MethodDefinition.PInvokeInfo.Module.Name) + "_" + entryPoint.Substring(1);
return entryPoint;
}
开发者ID:huliang,项目名称:de4dot,代码行数:7,代码来源:TypeInfo.cs
示例18: RemoveMethodDef
public void RemoveMethodDef(MethodDef md) {
if (!MethodDefs.Remove(md))
throw new ApplicationException(string.Format("Could not remove MethodDef: {0}", md));
}
开发者ID:ximing-kooboo,项目名称:de4dot,代码行数:4,代码来源:MemberRefFinder.cs
示例19: prepareRenameMethodArgs
void prepareRenameMethodArgs(MethodDef methodDef)
{
if (methodDef.ParamDefs.Count > 0) {
if (isEventHandler(methodDef)) {
ParamInfo info;
info = param(methodDef.ParamDefs[0]);
if (!info.gotNewName())
info.newName = "sender";
info = param(methodDef.ParamDefs[1]);
if (!info.gotNewName())
info.newName = "e";
}
else {
var newVariableNameState = variableNameState.cloneParamsOnly();
var checker = NameChecker;
foreach (var paramDef in methodDef.ParamDefs) {
var info = param(paramDef);
if (info.gotNewName())
continue;
if (!checker.isValidMethodArgName(info.oldName))
info.newName = newVariableNameState.getNewParamName(info.oldName, paramDef.ParameterDefinition);
}
}
}
if ((methodDef.Property != null && methodDef == methodDef.Property.SetMethod) ||
(methodDef.Event != null && (methodDef == methodDef.Event.AddMethod || methodDef == methodDef.Event.RemoveMethod))) {
if (methodDef.ParamDefs.Count > 0) {
var paramDef = methodDef.ParamDefs[methodDef.ParamDefs.Count - 1];
param(paramDef).newName = "value";
}
}
}
开发者ID:huliang,项目名称:de4dot,代码行数:35,代码来源:TypeInfo.cs
示例20: addMethodIfEmpty
public void addMethodIfEmpty(TypeInfo iface, MethodDef ifaceMethod, MethodDef classMethod)
{
InterfaceMethodInfo info;
var key = new TypeReferenceKey(iface.typeReference);
if (!interfaceMethods.TryGetValue(key, out info))
throw new ApplicationException("Could not find interface");
info.addMethodIfEmpty(ifaceMethod, classMethod);
}
开发者ID:Perplexity,项目名称:de4dot,代码行数:8,代码来源:TypeDef.cs
注:本文中的de4dot.code.renamer.asmmodules.MethodDef类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论