• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# asmmodules.MethodNameGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中de4dot.code.renamer.asmmodules.MethodNameGroup的典型用法代码示例。如果您正苦于以下问题:C# MethodNameGroup类的具体用法?C# MethodNameGroup怎么用?C# MethodNameGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MethodNameGroup类属于de4dot.code.renamer.asmmodules命名空间,在下文中一共展示了MethodNameGroup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: isPropertyAvailable

 bool isPropertyAvailable(MethodNameGroup group, string methodName)
 {
     foreach (var method in group.Methods) {
         if (memberInfos.type(method.Owner).variableNameState.isPropertyNameUsed(methodName))
             return false;
     }
     return true;
 }
开发者ID:Joelone,项目名称:de4dot,代码行数:8,代码来源:Renamer.cs


示例2: RestoreExplicitVirtualProperties

		void RestoreExplicitVirtualProperties(MethodNameGroup group) {
			if (group.Methods.Count != 1)
				return;
			var propMethod = group.Methods[0];
			if (propMethod.Property != null)
				return;
			if (propMethod.MethodDef.Overrides.Count == 0)
				return;

			var theProperty = GetOverriddenProperty(propMethod);
			if (theProperty == null)
				return;

			CreateProperty(theProperty, propMethod, GetOverridePrefix(group, propMethod));
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:15,代码来源:Renamer.cs


示例3: RestoreExplicitVirtualEvents

		void RestoreExplicitVirtualEvents(MethodNameGroup group) {
			if (group.Methods.Count != 1)
				return;
			var eventMethod = group.Methods[0];
			if (eventMethod.Event != null)
				return;
			if (eventMethod.MethodDef.Overrides.Count == 0)
				return;

			MMethodDef overriddenMethod;
			var theEvent = GetOverriddenEvent(eventMethod, out overriddenMethod);
			if (theEvent == null)
				return;

			CreateEvent(theEvent, eventMethod, GetEventMethodType(overriddenMethod), GetOverridePrefix(group, eventMethod));
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:16,代码来源:Renamer.cs


示例4: HasInvalidMethodName

		bool HasInvalidMethodName(MethodNameGroup group) {
			foreach (var method in group.Methods) {
				var typeInfo = memberInfos.Type(method.Owner);
				var methodInfo = memberInfos.Method(method);
				if (!typeInfo.NameChecker.IsValidMethodName(methodInfo.oldName))
					return true;
			}
			return false;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:9,代码来源:Renamer.cs


示例5: IsEventAvailable

		bool IsEventAvailable(MethodNameGroup group, string methodName) {
			foreach (var method in group.Methods) {
				if (memberInfos.Type(method.Owner).variableNameState.IsEventNameUsed(methodName))
					return false;
			}
			return true;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:Renamer.cs


示例6: GetOverrideMethod

		MMethodDef GetOverrideMethod(MethodNameGroup group) {
			foreach (var method in group.Methods) {
				if (method.MethodDef.Overrides.Count > 0)
					return method;
			}
			return null;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:Renamer.cs


示例7: Merge

			public void Merge(MergeStateFlags flags, MethodNameGroup group) {
				this.flags = flags;
				visited.Clear();
				foreach (var method in group.Methods)
					Merge(method.Owner);
			}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:6,代码来源:Renamer.cs


示例8: GetOverridePrefix

		static string GetOverridePrefix(MethodNameGroup group, MMethodDef method) {
			if (method == null || method.MethodDef.Overrides.Count == 0)
				return "";
			if (group.Methods.Count > 1) {
				// Don't use an override prefix if the group has an iface method.
				foreach (var m in group.Methods) {
					if (m.Owner.TypeDef.IsInterface)
						return "";
				}
			}
			var overrideMethod = method.MethodDef.Overrides[0].MethodDeclaration;
			if (overrideMethod.DeclaringType == null)
				return "";
			var name = overrideMethod.DeclaringType.FullName.Replace('/', '.');
			name = removeGenericsArityRegex.Replace(name, "");
			return name + ".";
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:17,代码来源:Renamer.cs


示例9: PrepareRenameEvent

		void PrepareRenameEvent(MethodNameGroup group, bool renameOverrides) {
			string methodPrefix, overridePrefix;
			var eventName = PrepareRenameEvent(group, renameOverrides, out overridePrefix, out methodPrefix);
			if (eventName == null)
				return;

			var methodName = overridePrefix + methodPrefix + eventName;
			foreach (var method in group.Methods)
				memberInfos.Method(method).Rename(methodName);
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:10,代码来源:Renamer.cs


示例10: GetValidArgNames

		string[] GetValidArgNames(MethodNameGroup group) {
			var methods = new List<MMethodDef>(group.Methods);
			foreach (var method in group.Methods) {
				foreach (var ovrd in method.MethodDef.Overrides) {
					var overrideRef = ovrd.MethodDeclaration;
					var overrideDef = modules.ResolveMethod(overrideRef);
					if (overrideDef == null) {
						var typeDef = modules.ResolveType(overrideRef.DeclaringType) ?? modules.ResolveOther(overrideRef.DeclaringType);
						if (typeDef == null)
							continue;
						overrideDef = typeDef.FindMethod(overrideRef);
						if (overrideDef == null)
							continue;
					}
					if (overrideDef.VisibleParameterCount != method.VisibleParameterCount)
						continue;
					methods.Add(overrideDef);
				}
			}

			var argNames = new string[group.Methods[0].ParamDefs.Count];
			foreach (var method in methods) {
				var nameChecker = !method.Owner.HasModule ? null : method.Owner.Module.ObfuscatedFile.NameChecker;
				for (int i = 0; i < argNames.Length; i++) {
					var argName = method.ParamDefs[i].ParameterDef.Name;
					if (nameChecker == null || nameChecker.IsValidMethodArgName(argName))
						argNames[i] = argName;
				}
			}
			return argNames;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:31,代码来源:Renamer.cs


示例11: Add

			public void Add(MethodNameGroup group) {
				groups.Add(group);
			}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:3,代码来源:Renamer.cs


示例12: merge

        void merge(MethodNameGroup a, MethodNameGroup b)
        {
            if (a == b)
                return;

            if (a.Count < b.Count) {
                MethodNameGroup tmp = a;
                a = b;
                b = tmp;
            }
            a.merge(b);
            foreach (var methodDef in b.Methods)
                methodGroups[methodDef] = a;
        }
开发者ID:Joelone,项目名称:de4dot,代码行数:14,代码来源:MethodNameGroups.cs


示例13: 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


示例14: GetNewPropertyNamePrefix

		string GetNewPropertyNamePrefix(MethodNameGroup group) {
			const string defaultVal = "Prop_";

			var propType = GetPropertyType(group);
			if (propType == null)
				return defaultVal;

			var elementType = propType.ScopeType.ToTypeSig(false).RemovePinnedAndModifiers();
			if (propType is GenericInstSig || elementType is GenericSig)
				return defaultVal;

			var prefix = GetPrefix(propType);

			string name = elementType.TypeName;
			int i;
			if ((i = name.IndexOf('`')) >= 0)
				name = name.Substring(0, i);
			if ((i = name.LastIndexOf('.')) >= 0)
				name = name.Substring(i + 1);
			if (name == "")
				return defaultVal;

			return prefix.ToUpperInvariant() + UpperFirst(name) + "_";
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:24,代码来源:Renamer.cs


示例15: GetPropertyType

		// Returns property type, or null if not all methods have the same type
		TypeSig GetPropertyType(MethodNameGroup group) {
			var methodType = GetPropertyMethodType(group.Methods[0]);
			if (methodType == PropertyMethodType.Other)
				return null;

			TypeSig type = null;
			foreach (var propMethod in group.Methods) {
				TypeSig propType;
				if (methodType == PropertyMethodType.Setter)
					propType = propMethod.ParamDefs[propMethod.ParamDefs.Count - 1].ParameterDef.Type;
				else
					propType = propMethod.MethodDef.MethodSig.GetRetType();
				if (type == null)
					type = propType;
				else if (!new SigComparer().Equals(type, propType))
					return null;
			}
			return type;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:20,代码来源:Renamer.cs


示例16: GetEventMethod

		MMethodDef GetEventMethod(MethodNameGroup group) {
			foreach (var method in group.Methods) {
				if (method.Event != null)
					return method;
			}
			return null;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:Renamer.cs


示例17: PrepareRenameVirtualMethods

		void PrepareRenameVirtualMethods(MethodNameGroup group, string namePrefix, bool renameOverrides) {
			if (!HasInvalidMethodName(group))
				return;

			if (HasDelegateOwner(group)) {
				switch (group.Methods[0].MethodDef.Name.String) {
				case "Invoke":
				case "BeginInvoke":
				case "EndInvoke":
					return;
				}
			}

			var overrideMethod = GetOverrideMethod(group);
			var overridePrefix = GetOverridePrefix(group, overrideMethod);
			if (renameOverrides && overridePrefix == "")
				return;
			if (!renameOverrides && overridePrefix != "")
				return;

			string newMethodName;
			if (overridePrefix != "") {
				var overrideInfo = memberInfos.Method(overrideMethod);
				var overriddenMethod = GetOverriddenMethod(overrideMethod);
				if (overriddenMethod == null)
					newMethodName = GetRealName(overrideMethod.MethodDef.Overrides[0].MethodDeclaration.Name.String);
				else
					newMethodName = GetRealName(memberInfos.Method(overriddenMethod).newName);
			}
			else {
				newMethodName = GetSuggestedMethodName(group);
				if (newMethodName == null) {
					mergeStateHelper.Merge(MergeStateFlags.Methods, group);
					newMethodName = GetAvailableName(namePrefix, false, group, (group2, newName) => IsMethodAvailable(group2, newName));
				}
			}

			var newMethodNameWithPrefix = overridePrefix + newMethodName;
			foreach (var method in group.Methods)
				memberInfos.Type(method.Owner).RenameMethod(method, newMethodNameWithPrefix);
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:41,代码来源:Renamer.cs


示例18: PrepareRenameProperty

		void PrepareRenameProperty(MethodNameGroup group, bool renameOverrides) {
			string overridePrefix;
			var propName = PrepareRenameProperty(group, renameOverrides, out overridePrefix);
			if (propName == null)
				return;

			string methodPrefix;
			switch (GetPropertyMethodType(group.Methods[0])) {
			case PropertyMethodType.Getter:
				methodPrefix = "get_";
				break;
			case PropertyMethodType.Setter:
				methodPrefix = "set_";
				break;
			default:
				throw new ApplicationException("Invalid property type");
			}

			var methodName = overridePrefix + methodPrefix + propName;
			foreach (var method in group.Methods)
				memberInfos.Method(method).Rename(methodName);
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:22,代码来源:Renamer.cs


示例19: GetSuggestedMethodName

		string GetSuggestedMethodName(MethodNameGroup group) {
			foreach (var method in group.Methods) {
				var info = memberInfos.Method(method);
				if (info.suggestedName != null)
					return info.suggestedName;
			}
			return null;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:8,代码来源:Renamer.cs


示例20: GetAvailableName

		static string GetAvailableName(string prefix, bool tryWithoutZero, MethodNameGroup group, Func<MethodNameGroup, string, bool> checkAvailable) {
			for (int i = 0; ; i++) {
				string newName = i == 0 && tryWithoutZero ? prefix : prefix + i;
				if (checkAvailable(group, newName))
					return newName;
			}
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:Renamer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Context.DeneysanContext类代码示例发布时间:2022-05-26
下一篇:
C# asmmodules.MethodDef类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap