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


C# TypeWrapper.GetMethods方法代码示例

本文整理汇总了C#中TypeWrapper.GetMethods方法的典型用法代码示例。如果您正苦于以下问题:C# TypeWrapper.GetMethods方法的具体用法?C# TypeWrapper.GetMethods怎么用?C# TypeWrapper.GetMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypeWrapper的用法示例。


在下文中一共展示了TypeWrapper.GetMethods方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HasJavaMethods

		private static bool HasJavaMethods(TypeWrapper tw)
		{
			foreach (MethodWrapper mw in tw.GetMethods())
			{
				if (!mw.IsHideFromReflection && mw.Name != StringConstants.CLINIT)
				{
					return true;
				}
			}
			return false;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:11,代码来源:SerialVersionUID.cs

示例2: HasJavaMethods

		private static bool HasJavaMethods(TypeWrapper tw)
		{
			foreach (MethodWrapper mw in tw.GetMethods())
			{
				if (!mw.IsHideFromReflection && !mw.IsClassInitializer)
				{
					return true;
				}
			}
			return false;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:11,代码来源:SerialVersionUID.cs

示例3: WriteMethods

		private static void WriteMethods(BigEndianStream bes, TypeWrapper tw)
		{
			List<MethodWrapper> list = new List<MethodWrapper>();
			foreach (MethodWrapper mw in tw.GetMethods())
			{
				if (mw.Name != StringConstants.INIT && !mw.IsHideFromReflection && !mw.IsPrivate)
				{
					list.Add(mw);
				}
			}
			list.Sort(delegate(MethodWrapper mw1, MethodWrapper mw2) {
				if (mw1.Name == mw2.Name)
					return String.CompareOrdinal(mw1.Signature, mw2.Signature);
				return String.CompareOrdinal(mw1.Name, mw2.Name); 
			});
			foreach (MethodWrapper mw in list)
			{
				Modifiers mods = mw.Modifiers & (Modifiers.Public | Modifiers.Private | Modifiers.Protected | Modifiers.Static | Modifiers.Final | Modifiers.Synchronized | Modifiers.Native | Modifiers.Abstract | Modifiers.Strictfp);
				bes.WriteUtf8(mw.Name);
				bes.WriteUInt32((uint)mods);
				bes.WriteUtf8(mw.Signature);
			}
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:23,代码来源:SerialVersionUID.cs

示例4: WriteClass

 internal static void WriteClass(Stream stream, TypeWrapper tw, bool includeNonPublicInterfaces, bool includeNonPublicMembers, bool includeSerialVersionUID, bool includeParameterNames)
 {
     string name = tw.Name.Replace('.', '/');
     string super = null;
     if (tw.IsInterface)
     {
         super = "java/lang/Object";
     }
     else if (tw.BaseTypeWrapper != null)
     {
         super = tw.BaseTypeWrapper.Name.Replace('.', '/');
     }
     ClassFileWriter writer = new ClassFileWriter(tw.Modifiers, name, super, 0, includeParameterNames ? (ushort)52 : (ushort)49);
     foreach (TypeWrapper iface in tw.Interfaces)
     {
         if (iface.IsPublic || includeNonPublicInterfaces)
         {
             writer.AddInterface(iface.Name.Replace('.', '/'));
         }
     }
     InnerClassesAttribute innerClassesAttribute = null;
     if (tw.DeclaringTypeWrapper != null)
     {
         TypeWrapper outer = tw.DeclaringTypeWrapper;
         string innername = name;
         int idx = name.LastIndexOf('$');
         if (idx >= 0)
         {
             innername = innername.Substring(idx + 1);
         }
         innerClassesAttribute = new InnerClassesAttribute(writer);
         innerClassesAttribute.Add(name, outer.Name.Replace('.', '/'), innername, (ushort)tw.ReflectiveModifiers);
     }
     foreach (TypeWrapper inner in tw.InnerClasses)
     {
         if (inner.IsPublic)
         {
             if (innerClassesAttribute == null)
             {
                 innerClassesAttribute = new InnerClassesAttribute(writer);
             }
             string namePart = inner.Name;
             namePart = namePart.Substring(namePart.LastIndexOf('$') + 1);
             innerClassesAttribute.Add(inner.Name.Replace('.', '/'), name, namePart, (ushort)inner.ReflectiveModifiers);
         }
     }
     if (innerClassesAttribute != null)
     {
         writer.AddAttribute(innerClassesAttribute);
     }
     string genericTypeSignature = tw.GetGenericSignature();
     if (genericTypeSignature != null)
     {
         writer.AddStringAttribute("Signature", genericTypeSignature);
     }
     AddAnnotations(writer, writer, tw.TypeAsBaseType);
     writer.AddStringAttribute("IKVM.NET.Assembly", GetAssemblyName(tw));
     if (tw.TypeAsBaseType.IsDefined(JVM.Import(typeof(ObsoleteAttribute)), false))
     {
         writer.AddAttribute(new DeprecatedAttribute(writer));
     }
     foreach (MethodWrapper mw in tw.GetMethods())
     {
         if (!mw.IsHideFromReflection && (mw.IsPublic || mw.IsProtected || includeNonPublicMembers))
         {
             FieldOrMethod m;
             if (mw.Name == "<init>")
             {
                 m = writer.AddMethod(mw.Modifiers, mw.Name, mw.Signature.Replace('.', '/'));
                 CodeAttribute code = new CodeAttribute(writer);
                 code.MaxLocals = (ushort)(mw.GetParameters().Length * 2 + 1);
                 code.MaxStack = 3;
                 ushort index1 = writer.AddClass("java/lang/UnsatisfiedLinkError");
                 ushort index2 = writer.AddString("ikvmstub generated stubs can only be used on IKVM.NET");
                 ushort index3 = writer.AddMethodRef("java/lang/UnsatisfiedLinkError", "<init>", "(Ljava/lang/String;)V");
                 code.ByteCode = new byte[] {
                 187, (byte)(index1 >> 8), (byte)index1,	// new java/lang/UnsatisfiedLinkError
                 89,										// dup
                 19,	 (byte)(index2 >> 8), (byte)index2,	// ldc_w "..."
                 183, (byte)(index3 >> 8), (byte)index3, // invokespecial java/lang/UnsatisfiedLinkError/init()V
                 191										// athrow
             };
                 m.AddAttribute(code);
             }
             else
             {
                 Modifiers mods = mw.Modifiers;
                 if ((mods & Modifiers.Abstract) == 0)
                 {
                     mods |= Modifiers.Native;
                 }
                 m = writer.AddMethod(mods, mw.Name, mw.Signature.Replace('.', '/'));
                 if (mw.IsOptionalAttributeAnnotationValue)
                 {
                     m.AddAttribute(new AnnotationDefaultClassFileAttribute(writer, GetAnnotationDefault(writer, mw.ReturnType)));
                 }
             }
             MethodBase mb = mw.GetMethod();
             if (mb != null)
             {
//.........这里部分代码省略.........
开发者ID:T0pp3r,项目名称:ikvm-fork,代码行数:101,代码来源:StubGenerator.cs

示例5: GatherAllInterfaceMethods

		private static bool GatherAllInterfaceMethods(TypeWrapper tw, ClassFile.ConstantPoolItemMethodType[] bridges, Dictionary<MethodKey, MethodWrapper> methods,
			ref int abstractMethodCount, ref int bridgeMethodCount)
		{
			foreach (MethodWrapper mw in tw.GetMethods())
			{
				if (mw.IsVirtual)
				{
					MirandaMethodWrapper mmw = mw as MirandaMethodWrapper;
					if (mmw != null)
					{
						if (mmw.Error != null)
						{
							return false;
						}
						continue;
					}
					MethodKey key = new MethodKey("", mw.Name, mw.Signature);
					MethodWrapper current;
					if (methods.TryGetValue(key, out current))
					{
						if (!MatchSignatures(mw, current))
						{
							// linkage error (or unloadable type)
							return false;
						}
					}
					else
					{
						methods.Add(key, mw);
						if (mw.IsAbstract && !IsObjectMethod(mw))
						{
							if (bridges != null && IsBridge(mw, bridges))
							{
								bridgeMethodCount++;
							}
							else
							{
								abstractMethodCount++;
							}
						}
					}
					mw.Link();
					if (mw.GetMethod() == null)
					{
						return false;
					}
					if (current != null && mw.RealName != current.RealName)
					{
						return false;
					}
				}
			}
			foreach (TypeWrapper tw1 in tw.Interfaces)
			{
				if (!GatherAllInterfaceMethods(tw1, bridges, methods, ref abstractMethodCount, ref bridgeMethodCount))
				{
					return false;
				}
			}
			return true;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:61,代码来源:LambdaMetafactory.cs

示例6: GetInterfaceMethods

		private static IEnumerable<MethodWrapper> GetInterfaceMethods(TypeWrapper tw)
		{
			Dictionary<string, MethodWrapper> methods = new Dictionary<string, MethodWrapper>();
			foreach (MethodWrapper mw in tw.GetMethods())
			{
				methods.Add(mw.Name + mw.Signature, mw);
			}
			foreach (TypeWrapper iface in tw.Interfaces)
			{
				foreach (MethodWrapper mw in GetInterfaceMethods(iface))
				{
					if (!methods.ContainsKey(mw.Name + mw.Signature))
					{
						methods.Add(mw.Name + mw.Signature, mw);
					}
				}
			}
			return methods.Values;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:19,代码来源:Proxy.cs


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