本文整理汇总了C#中de4dot.code.renamer.asmmodules.MMethodDef.IsVirtual方法的典型用法代码示例。如果您正苦于以下问题:C# MMethodDef.IsVirtual方法的具体用法?C# MMethodDef.IsVirtual怎么用?C# MMethodDef.IsVirtual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de4dot.code.renamer.asmmodules.MMethodDef
的用法示例。
在下文中一共展示了MMethodDef.IsVirtual方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public MethodNameGroup Get(MMethodDef 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;
}
示例2: 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;
}
示例3: RenameMethod
void RenameMethod(MMethodDef methodDef) {
if (methodDef.IsVirtual())
throw new ApplicationException("Can't rename virtual methods here");
if (!CanRenameMethod(methodDef))
return;
var info = Method(methodDef);
if (info.renamed)
return;
info.renamed = true;
var checker = NameChecker;
// PInvoke methods' EntryPoint is always valid. It has to, so always rename.
bool isValidName = NameChecker.IsValidMethodName(info.oldName);
bool isExternPInvoke = methodDef.MethodDef.ImplMap != null && methodDef.MethodDef.RVA == 0;
if (!isValidName || isExternPInvoke) {
INameCreator nameCreator = null;
string newName = info.suggestedName;
string newName2;
if (methodDef.MethodDef.ImplMap != null && !string.IsNullOrEmpty(newName2 = GetPinvokeName(methodDef)))
newName = newName2;
else if (methodDef.IsStatic())
nameCreator = variableNameState.staticMethodNameCreator;
else
nameCreator = variableNameState.instanceMethodNameCreator;
if (!string.IsNullOrEmpty(newName))
nameCreator = new NameCreator2(newName);
RenameMethod(methodDef, variableNameState.GetNewMethodName(info.oldName, nameCreator));
}
}
示例4: RenameSpecialMethod
void RenameSpecialMethod(MMethodDef methodDef, string newName) {
if (methodDef == null)
return;
if (methodDef.IsVirtual())
return;
RenameMethod(methodDef, newName);
}