当前位置: 首页>>代码示例>>C#>>正文


C# asmmodules.MethodNameGroup类代码示例

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


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


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