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

C# Reflection.Module类代码示例

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

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



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

示例1: GetPropertySigHelper

		public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
		{
			SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, Signature.PROPERTY);
			sig.returnType = returnType;
			foreach (Type type in parameterTypes)
			{
				sig.AddArgument(type);
			}
			return sig;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:10,代码来源:SignatureHelper.cs


示例2: GetPropertySigHelper

		public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes)
		{
			SignatureHelper sig = new SignatureHelper(mod as ModuleBuilder, Signature.PROPERTY);
			sig.returnType = returnType;
			sig.returnTypeOptionalCustomModifiers = Type.EmptyTypes;
			sig.returnTypeRequiredCustomModifiers = Type.EmptyTypes;
			foreach (Type type in parameterTypes)
			{
				sig.AddArgument(type);
			}
			return sig;
		}
开发者ID:koush,项目名称:mono,代码行数:12,代码来源:SignatureHelper.cs


示例3: ReadFieldMarshal

		internal static bool ReadFieldMarshal(Module module, int token, out FieldMarshal fm)
		{
			fm = new FieldMarshal();
			foreach (int i in module.FieldMarshal.Filter(token))
			{
				ByteReader blob = module.GetBlob(module.FieldMarshal.records[i].NativeType);
				fm.UnmanagedType = (UnmanagedType)blob.ReadCompressedUInt();
				if (fm.UnmanagedType == UnmanagedType.LPArray)
				{
					fm.ArraySubType = (UnmanagedType)blob.ReadCompressedUInt();
					if (fm.ArraySubType == NATIVE_TYPE_MAX)
					{
						fm.ArraySubType = null;
					}
					if (blob.Length != 0)
					{
						fm.SizeParamIndex = (short)blob.ReadCompressedUInt();
						if (blob.Length != 0)
						{
							fm.SizeConst = blob.ReadCompressedUInt();
							if (blob.Length != 0 && blob.ReadCompressedUInt() == 0)
							{
								fm.SizeParamIndex = null;
							}
						}
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.SafeArray)
				{
					if (blob.Length != 0)
					{
						fm.SafeArraySubType = (VarEnum)blob.ReadCompressedUInt();
						if (blob.Length != 0)
						{
							fm.SafeArrayUserDefinedSubType = ReadType(module, blob);
						}
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.ByValArray)
				{
					fm.SizeConst = blob.ReadCompressedUInt();
					if (blob.Length != 0)
					{
						fm.ArraySubType = (UnmanagedType)blob.ReadCompressedUInt();
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.ByValTStr)
				{
					fm.SizeConst = blob.ReadCompressedUInt();
				}
				else if (fm.UnmanagedType == UnmanagedType.Interface
					|| fm.UnmanagedType == UnmanagedType.IDispatch
					|| fm.UnmanagedType == UnmanagedType.IUnknown)
				{
					if (blob.Length != 0)
					{
						fm.IidParameterIndex = blob.ReadCompressedUInt();
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.CustomMarshaler)
				{
					blob.ReadCompressedUInt();
					blob.ReadCompressedUInt();
					fm.MarshalType = ReadString(blob);
					fm.MarshalCookie = ReadString(blob);

					TypeNameParser parser = TypeNameParser.Parse(fm.MarshalType, false);
					if (!parser.Error)
					{
						fm.MarshalTypeRef = parser.GetType(module.universe, module, false, fm.MarshalType, false, false);
					}
				}
				return true;
			}
			return false;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:76,代码来源:MarshalSpec.cs


示例4: ReadType

		private static Type ReadType(Module module, ByteReader br)
		{
			string str = ReadString(br);
			if (str == "")
			{
				return null;
			}
			return module.Assembly.GetType(str) ?? module.universe.GetType(str, true);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:9,代码来源:MarshalSpec.cs


示例5: MissingType

		internal MissingType(Module module, Type declaringType, string ns, string name)
		{
			this.module = module;
			this.declaringType = declaringType;
			this.ns = ns;
			this.name = name;
		}
开发者ID:luobailiang,项目名称:mono,代码行数:7,代码来源:Missing.cs


示例6: CustomAttributeData

		// 1) Unresolved Custom Attribute
		internal CustomAttributeData(Module module, int index)
		{
			this.module = module;
			this.customAttributeIndex = index;
			this.declSecurityIndex = -1;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:7,代码来源:CustomAttributeData.cs


示例7: CreateDllImportPseudoCustomAttribute

		internal static CustomAttributeData CreateDllImportPseudoCustomAttribute(Module module, ImplMapFlags flags, string entryPoint, string dllName, MethodImplAttributes attr)
		{
			Type type = module.universe.System_Runtime_InteropServices_DllImportAttribute;
			ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_String);
			List<CustomAttributeNamedArgument> list = new List<CustomAttributeNamedArgument>();
			System.Runtime.InteropServices.CharSet charSet;
			switch (flags & ImplMapFlags.CharSetMask)
			{
				case ImplMapFlags.CharSetAnsi:
					charSet = System.Runtime.InteropServices.CharSet.Ansi;
					break;
				case ImplMapFlags.CharSetUnicode:
					charSet = System.Runtime.InteropServices.CharSet.Unicode;
					break;
				case ImplMapFlags.CharSetAuto:
					charSet = System.Runtime.InteropServices.CharSet.Auto;
					break;
				case ImplMapFlags.CharSetNotSpec:
				default:
					charSet = System.Runtime.InteropServices.CharSet.None;
					break;
			}
			System.Runtime.InteropServices.CallingConvention callingConvention;
			switch (flags & ImplMapFlags.CallConvMask)
			{
				case ImplMapFlags.CallConvCdecl:
					callingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;
					break;
				case ImplMapFlags.CallConvFastcall:
					callingConvention = System.Runtime.InteropServices.CallingConvention.FastCall;
					break;
				case ImplMapFlags.CallConvStdcall:
					callingConvention = System.Runtime.InteropServices.CallingConvention.StdCall;
					break;
				case ImplMapFlags.CallConvThiscall:
					callingConvention = System.Runtime.InteropServices.CallingConvention.ThisCall;
					break;
				case ImplMapFlags.CallConvWinapi:
					callingConvention = System.Runtime.InteropServices.CallingConvention.Winapi;
					break;
				default:
					callingConvention = 0;
					break;
			}
			AddNamedArgument(list, type, "EntryPoint", entryPoint);
			AddNamedArgument(list, type, "CharSet", module.universe.System_Runtime_InteropServices_CharSet, (int)charSet);
			AddNamedArgument(list, type, "ExactSpelling", (int)flags, (int)ImplMapFlags.NoMangle);
			AddNamedArgument(list, type, "SetLastError", (int)flags, (int)ImplMapFlags.SupportsLastError);
			AddNamedArgument(list, type, "PreserveSig", (int)attr, (int)MethodImplAttributes.PreserveSig);
			AddNamedArgument(list, type, "CallingConvention", module.universe.System_Runtime_InteropServices_CallingConvention, (int)callingConvention);
			AddNamedArgument(list, type, "BestFitMapping", (int)flags, (int)ImplMapFlags.BestFitOn);
			AddNamedArgument(list, type, "ThrowOnUnmappableChar", (int)flags, (int)ImplMapFlags.CharMapErrorOn);
			return new CustomAttributeData(module, constructor, new object[] { dllName }, list);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:54,代码来源:CustomAttributeData.cs


示例8: __GetCustomAttributes

		public static IList<CustomAttributeData> __GetCustomAttributes(Module module, Type attributeType, bool inherit)
		{
			if (module.__IsMissing)
			{
				throw new MissingModuleException((MissingModule)module);
			}
			return GetCustomAttributesImpl(null, module, 0x00000001, attributeType) ?? EmptyList;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:8,代码来源:CustomAttributeData.cs


示例9: ReadDeclarativeSecurity

		internal static void ReadDeclarativeSecurity(Module module, int index, List<CustomAttributeData> list)
		{
			Universe u = module.universe;
			Assembly asm = module.Assembly;
			int action = module.DeclSecurity.records[index].Action;
			ByteReader br = module.GetBlob(module.DeclSecurity.records[index].PermissionSet);
			if (br.PeekByte() == '.')
			{
				br.ReadByte();
				int count = br.ReadCompressedUInt();
				for (int j = 0; j < count; j++)
				{
					Type type = ReadType(module, br);
					ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
					// LAMESPEC there is an additional length here (probably of the named argument list)
					byte[] blob = br.ReadBytes(br.ReadCompressedUInt());
					list.Add(new CustomAttributeData(asm, constructor, action, blob, index));
				}
			}
			else
			{
				// .NET 1.x format (xml)
				char[] buf = new char[br.Length / 2];
				for (int i = 0; i < buf.Length; i++)
				{
					buf[i] = br.ReadChar();
				}
				string xml = new String(buf);
				ConstructorInfo constructor = u.System_Security_Permissions_PermissionSetAttribute.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
				List<CustomAttributeNamedArgument> args = new List<CustomAttributeNamedArgument>();
				args.Add(new CustomAttributeNamedArgument(GetProperty(null, u.System_Security_Permissions_PermissionSetAttribute, "XML", u.System_String),
					new CustomAttributeTypedArgument(u.System_String, xml)));
				list.Add(new CustomAttributeData(asm.ManifestModule, constructor, new object[] { action }, args));
			}
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:35,代码来源:CustomAttributeData.cs


示例10: CreatePreserveSigPseudoCustomAttribute

		internal static CustomAttributeData CreatePreserveSigPseudoCustomAttribute(Module module)
		{
			Type type = module.universe.System_Runtime_InteropServices_PreserveSigAttribute;
			ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor();
			return new CustomAttributeData(module, constructor, Empty<object>.Array, null);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:6,代码来源:CustomAttributeData.cs


示例11: CreateFieldOffsetPseudoCustomAttribute

		internal static CustomAttributeData CreateFieldOffsetPseudoCustomAttribute(Module module, int offset)
		{
			Type type = module.universe.System_Runtime_InteropServices_FieldOffsetAttribute;
			ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(module.universe.System_Int32);
			return new CustomAttributeData(module, constructor, new object[] { offset }, null);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:6,代码来源:CustomAttributeData.cs


示例12: __GetCustomAttributes

		public static IList<CustomAttributeData> __GetCustomAttributes(Module module, Type attributeType, bool inherit)
		{
			return module.GetCustomAttributesData(attributeType);
		}
开发者ID:,项目名称:,代码行数:4,代码来源:


示例13: GetProperty

		private static PropertyInfo GetProperty(Module context, Type type, string name, Type propertyType)
		{
			Type org = type;
			for (; type != null && !type.__IsMissing; type = type.BaseType)
			{
				foreach (PropertyInfo property in type.__GetDeclaredProperties())
				{
					if (property.IsPublic && !property.IsStatic && property.Name == name)
					{
						return property;
					}
				}
			}
			// if the property is missing, we stick the missing property on the first missing base type
			if (type == null)
			{
				type = org;
			}
			return type.Module.universe.GetMissingPropertyOrThrow(context, type, name,
				PropertySignature.Create(CallingConventions.Standard | CallingConventions.HasThis, propertyType, null, new PackedCustomModifiers()));
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:21,代码来源:CustomAttributeData.cs


示例14: GetCustomAttributes

		public static IList<CustomAttributeData> GetCustomAttributes(Module module)
		{
			return __GetCustomAttributes(module, null, false);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:4,代码来源:CustomAttributeData.cs


示例15: GetCustomAttributesImpl

		internal static List<CustomAttributeData> GetCustomAttributesImpl(List<CustomAttributeData> list, Module module, int token, Type attributeType)
		{
			foreach (int i in module.CustomAttribute.Filter(token))
			{
				if (attributeType == null)
				{
					if (list == null)
					{
						list = new List<CustomAttributeData>();
					}
					list.Add(new CustomAttributeData(module, i));
				}
				else
				{
					if (attributeType.IsAssignableFrom(module.ResolveMethod(module.CustomAttribute.records[i].Type).DeclaringType))
					{
						if (list == null)
						{
							list = new List<CustomAttributeData>();
						}
						list.Add(new CustomAttributeData(module, i));
					}
				}
			}
			return list;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:26,代码来源:CustomAttributeData.cs


示例16: ReadFieldOrPropType

		private static Type ReadFieldOrPropType(Module context, ByteReader br)
		{
			Universe u = context.universe;
			switch (br.ReadByte())
			{
				case Signature.ELEMENT_TYPE_BOOLEAN:
					return u.System_Boolean;
				case Signature.ELEMENT_TYPE_CHAR:
					return u.System_Char;
				case Signature.ELEMENT_TYPE_I1:
					return u.System_SByte;
				case Signature.ELEMENT_TYPE_U1:
					return u.System_Byte;
				case Signature.ELEMENT_TYPE_I2:
					return u.System_Int16;
				case Signature.ELEMENT_TYPE_U2:
					return u.System_UInt16;
				case Signature.ELEMENT_TYPE_I4:
					return u.System_Int32;
				case Signature.ELEMENT_TYPE_U4:
					return u.System_UInt32;
				case Signature.ELEMENT_TYPE_I8:
					return u.System_Int64;
				case Signature.ELEMENT_TYPE_U8:
					return u.System_UInt64;
				case Signature.ELEMENT_TYPE_R4:
					return u.System_Single;
				case Signature.ELEMENT_TYPE_R8:
					return u.System_Double;
				case Signature.ELEMENT_TYPE_STRING:
					return u.System_String;
				case Signature.ELEMENT_TYPE_SZARRAY:
					return ReadFieldOrPropType(context, br).MakeArrayType();
				case 0x55:
					return ReadType(context, br);
				case 0x50:
					return u.System_Type;
				case 0x51:
					return u.System_Object;
				default:
					throw new BadImageFormatException();
			}
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:43,代码来源:CustomAttributeData.cs


示例17: CreateMarshalAsPseudoCustomAttribute

		internal static CustomAttributeData CreateMarshalAsPseudoCustomAttribute(Module module, FieldMarshal fm)
		{
			Type typeofMarshalAs = module.universe.System_Runtime_InteropServices_MarshalAsAttribute;
			Type typeofUnmanagedType = module.universe.System_Runtime_InteropServices_UnmanagedType;
			Type typeofVarEnum = module.universe.System_Runtime_InteropServices_VarEnum;
			Type typeofType = module.universe.System_Type;
			List<CustomAttributeNamedArgument> named = new List<CustomAttributeNamedArgument>();
			AddNamedArgument(named, typeofMarshalAs, "ArraySubType", typeofUnmanagedType, (int)(fm.ArraySubType ?? 0));
			AddNamedArgument(named, typeofMarshalAs, "SizeParamIndex", module.universe.System_Int16, fm.SizeParamIndex ?? 0);
			AddNamedArgument(named, typeofMarshalAs, "SizeConst", module.universe.System_Int32, fm.SizeConst ?? 0);
			AddNamedArgument(named, typeofMarshalAs, "IidParameterIndex", module.universe.System_Int32, fm.IidParameterIndex ?? 0);
			AddNamedArgument(named, typeofMarshalAs, "SafeArraySubType", typeofVarEnum, (int)(fm.SafeArraySubType ?? 0));
			if (fm.SafeArrayUserDefinedSubType != null)
			{
				AddNamedArgument(named, typeofMarshalAs, "SafeArrayUserDefinedSubType", typeofType, fm.SafeArrayUserDefinedSubType);
			}
			if (fm.MarshalType != null)
			{
				AddNamedArgument(named, typeofMarshalAs, "MarshalType", module.universe.System_String, fm.MarshalType);
			}
			if (fm.MarshalTypeRef != null)
			{
				AddNamedArgument(named, typeofMarshalAs, "MarshalTypeRef", module.universe.System_Type, fm.MarshalTypeRef);
			}
			if (fm.MarshalCookie != null)
			{
				AddNamedArgument(named, typeofMarshalAs, "MarshalCookie", module.universe.System_String, fm.MarshalCookie);
			}
			ConstructorInfo constructor = typeofMarshalAs.GetPseudoCustomAttributeConstructor(typeofUnmanagedType);
			return new CustomAttributeData(module, constructor, new object[] { (int)fm.UnmanagedType }, named);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:31,代码来源:CustomAttributeData.cs


示例18: ReadFixedArg

		private static CustomAttributeTypedArgument ReadFixedArg(Module context, ByteReader br, Type type)
		{
			Universe u = context.universe;
			if (type == u.System_String)
			{
				return new CustomAttributeTypedArgument(type, br.ReadString());
			}
			else if (type == u.System_Boolean)
			{
				return new CustomAttributeTypedArgument(type, br.ReadByte() != 0);
			}
			else if (type == u.System_Char)
			{
				return new CustomAttributeTypedArgument(type, br.ReadChar());
			}
			else if (type == u.System_Single)
			{
				return new CustomAttributeTypedArgument(type, br.ReadSingle());
			}
			else if (type == u.System_Double)
			{
				return new CustomAttributeTypedArgument(type, br.ReadDouble());
			}
			else if (type == u.System_SByte)
			{
				return new CustomAttributeTypedArgument(type, br.ReadSByte());
			}
			else if (type == u.System_Int16)
			{
				return new CustomAttributeTypedArgument(type, br.ReadInt16());
			}
			else if (type == u.System_Int32)
			{
				return new CustomAttributeTypedArgument(type, br.ReadInt32());
			}
			else if (type == u.System_Int64)
			{
				return new CustomAttributeTypedArgument(type, br.ReadInt64());
			}
			else if (type == u.System_Byte)
			{
				return new CustomAttributeTypedArgument(type, br.ReadByte());
			}
			else if (type == u.System_UInt16)
			{
				return new CustomAttributeTypedArgument(type, br.ReadUInt16());
			}
			else if (type == u.System_UInt32)
			{
				return new CustomAttributeTypedArgument(type, br.ReadUInt32());
			}
			else if (type == u.System_UInt64)
			{
				return new CustomAttributeTypedArgument(type, br.ReadUInt64());
			}
			else if (type == u.System_Type)
			{
				return new CustomAttributeTypedArgument(type, ReadType(context, br));
			}
			else if (type == u.System_Object)
			{
				return ReadFixedArg(context, br, ReadFieldOrPropType(context, br));
			}
			else if (type.IsArray)
			{
				int length = br.ReadInt32();
				if (length == -1)
				{
					return new CustomAttributeTypedArgument(type, null);
				}
				Type elementType = type.GetElementType();
				CustomAttributeTypedArgument[] array = new CustomAttributeTypedArgument[length];
				for (int i = 0; i < length; i++)
				{
					array[i] = ReadFixedArg(context, br, elementType);
				}
				return new CustomAttributeTypedArgument(type, array);
			}
			else if (type.IsEnum)
			{
				return new CustomAttributeTypedArgument(type, ReadFixedArg(context, br, type.GetEnumUnderlyingTypeImpl()).Value);
			}
			else
			{
				throw new InvalidOperationException();
			}
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:87,代码来源:CustomAttributeData.cs


示例19: ResolvedMissingMember

		private static void ResolvedMissingMember(Module requestingModule, MemberInfo member)
		{
			if (requestingModule != null && member is Type)
			{
				IssueMessage(Message.UnableToResolveType, requestingModule.Name, ((Type)member).FullName, member.Module.FullyQualifiedName);
			}
		}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:7,代码来源:CompilerClassLoader.cs


示例20: ReadType

		private static Type ReadType(Module context, ByteReader br)
		{
			string typeName = br.ReadString();
			if (typeName == null)
			{
				return null;
			}
			if (typeName.Length > 0 && typeName[typeName.Length - 1] == 0)
			{
				// there are broken compilers that emit an extra NUL character after the type name
				typeName = typeName.Substring(0, typeName.Length - 1);
			}
			return TypeNameParser.Parse(typeName, true).GetType(context.universe, context, true, typeName, true, false);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:14,代码来源:CustomAttributeData.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Reflection.Type类代码示例发布时间:2022-05-26
下一篇:
C# Reflection.Assembly类代码示例发布时间: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