本文整理汇总了C#中de4dot.code.renamer.asmmodules.MMethodDef类的典型用法代码示例。如果您正苦于以下问题:C# MMethodDef类的具体用法?C# MMethodDef怎么用?C# MMethodDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MMethodDef类属于de4dot.code.renamer.asmmodules命名空间,在下文中一共展示了MMethodDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addMethod
// Returns the previous method, or null if none
public MMethodDef addMethod(MMethodDef ifaceMethod, MMethodDef classMethod)
{
var ifaceKey = new MethodDefKey(ifaceMethod);
if (!ifaceMethodToClassMethod.ContainsKey(ifaceKey))
throw new ApplicationException("Could not find interface method");
MMethodDef oldMethod;
ifaceMethodToClassMethod.TryGetValue(ifaceKey, out oldMethod);
ifaceMethodToClassMethod[ifaceKey] = classMethod;
return oldMethod;
}
示例2: Add
public void Add(MMethodDef m) {
methods.Add(m);
}
示例3: GetEventMethodType
static EventMethodType GetEventMethodType(MMethodDef method) {
var evt = method.Event;
if (evt == null)
return EventMethodType.None;
if (evt.AddMethod == method)
return EventMethodType.Adder;
if (evt.RemoveMethod == method)
return EventMethodType.Remover;
if (evt.RaiseMethod == method)
return EventMethodType.Raiser;
return EventMethodType.Other;
}
示例4: CreatePropertySetter
MPropertyDef CreatePropertySetter(string name, MMethodDef propMethod) {
if (string.IsNullOrEmpty(name))
return null;
var ownerType = propMethod.Owner;
if (!ownerType.HasModule)
return null;
if (propMethod.Property != null)
return null;
var sig = propMethod.MethodDef.MethodSig;
if (sig == null || sig.Params.Count == 0)
return null;
var propType = sig.Params[sig.Params.Count - 1];
var propDef = CreateProperty(ownerType, name, propType, null, propMethod.MethodDef);
if (propDef == null)
return null;
if (propDef.SetMethod != null)
return null;
if (isVerbose)
Logger.v("Restoring property setter {0} ({1:X8}), Property: {2} ({3:X8})",
Utils.RemoveNewlines(propMethod),
propMethod.MethodDef.MDToken.ToInt32(),
Utils.RemoveNewlines(propDef.PropertyDef),
propDef.PropertyDef.MDToken.ToInt32());
propDef.PropertyDef.SetMethod = propMethod.MethodDef;
propDef.SetMethod = propMethod;
propMethod.Property = propDef;
return propDef;
}
示例5: GetOverriddenMethod
MMethodDef GetOverriddenMethod(MMethodDef overrideMethod) {
return modules.ResolveMethod(overrideMethod.MethodDef.Overrides[0].MethodDeclaration);
}
示例6: GetOverriddenProperty
MPropertyDef GetOverriddenProperty(MMethodDef overrideMethod) {
var theMethod = overrideMethod.MethodDef.Overrides[0].MethodDeclaration;
var overriddenMethod = modules.ResolveMethod(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.FindMethod(theMethod);
if (theMethodDef != null)
return theMethodDef.Property;
return null;
}
示例7: GetOverriddenEvent
MEventDef GetOverriddenEvent(MMethodDef overrideMethod) {
MMethodDef overriddenMethod;
return GetOverriddenEvent(overrideMethod, out overriddenMethod);
}
示例8: Add
public void Add(MMethodDef method) {
methods.Add(method);
}
示例9: CanRenameMethod
bool CanRenameMethod(MMethodDef methodDef) {
var methodInfo = Method(methodDef);
if (methodDef.IsStatic()) {
if (methodInfo.oldName == ".cctor")
return false;
}
else if (methodDef.IsVirtual()) {
if (DotNetUtils.DerivesFromDelegate(type.TypeDef)) {
switch (methodInfo.oldName) {
case "BeginInvoke":
case "EndInvoke":
case "Invoke":
return false;
}
}
}
else {
if (methodInfo.oldName == ".ctor")
return false;
}
return true;
}
示例10: PrepareRenameMethodArgs
void PrepareRenameMethodArgs(MMethodDef methodDef) {
VariableNameState newVariableNameState = null;
ParamInfo info;
if (methodDef.VisibleParameterCount > 0) {
if (IsEventHandler(methodDef)) {
info = Param(methodDef.ParamDefs[methodDef.VisibleParameterBaseIndex]);
if (!info.GotNewName())
info.newName = "sender";
info = Param(methodDef.ParamDefs[methodDef.VisibleParameterBaseIndex + 1]);
if (!info.GotNewName())
info.newName = "e";
}
else {
newVariableNameState = variableNameState.CloneParamsOnly();
var checker = NameChecker;
foreach (var paramDef in methodDef.ParamDefs) {
if (paramDef.IsHiddenThisParameter)
continue;
info = Param(paramDef);
if (info.GotNewName())
continue;
if (!checker.IsValidMethodArgName(info.oldName))
info.newName = newVariableNameState.GetNewParamName(info.oldName, paramDef.ParameterDef);
}
}
}
info = Param(methodDef.ReturnParamDef);
if (!info.GotNewName()) {
if (!NameChecker.IsValidMethodReturnArgName(info.oldName)) {
if (newVariableNameState == null)
newVariableNameState = variableNameState.CloneParamsOnly();
info.newName = newVariableNameState.GetNewParamName(info.oldName, methodDef.ReturnParamDef.ParameterDef);
}
}
if ((methodDef.Property != null && methodDef == methodDef.Property.SetMethod) ||
(methodDef.Event != null && (methodDef == methodDef.Event.AddMethod || methodDef == methodDef.Event.RemoveMethod))) {
if (methodDef.VisibleParameterCount > 0) {
var paramDef = methodDef.ParamDefs[methodDef.ParamDefs.Count - 1];
Param(paramDef).newName = "value";
}
}
}
示例11: RenameSpecialMethod
void RenameSpecialMethod(MMethodDef methodDef, string newName) {
if (methodDef == null)
return;
if (methodDef.IsVirtual())
return;
RenameMethod(methodDef, newName);
}
示例12: MethodInfo
public MethodInfo(MMethodDef methodDef)
: base(methodDef) {
}
示例13: Method
public MethodInfo Method(MMethodDef method) {
return allMethodInfos[method];
}
示例14: MethodInst
public MethodInst(MMethodDef origMethodDef, IMethodDefOrRef methodRef) {
this.origMethodDef = origMethodDef;
this.methodRef = methodRef;
}
示例15: MethodDefKey
public MethodDefKey(MMethodDef methodDef) {
this.methodDef = methodDef;
}