本文整理汇总了C#中de4dot.code.renamer.asmmodules.MMethodDef.isStatic方法的典型用法代码示例。如果您正苦于以下问题:C# MMethodDef.isStatic方法的具体用法?C# MMethodDef.isStatic怎么用?C# MMethodDef.isStatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de4dot.code.renamer.asmmodules.MMethodDef
的用法示例。
在下文中一共展示了MMethodDef.isStatic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
}
示例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;
}