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


C# ClassLoaderWrapper类代码示例

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


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

示例1: Create

		internal static void Create(ModuleBuilder modb, ClassLoaderWrapper loader)
		{
			TypeBuilder tb = modb.DefineType(DotNetTypeWrapper.GenericDelegateInterfaceTypeName, TypeAttributes.Interface | TypeAttributes.Abstract | TypeAttributes.Public);
			tb.DefineGenericParameters("T")[0].SetBaseTypeConstraint(Types.MulticastDelegate);
			genericDelegateInterfaceType = tb.CreateType();

			genericAttributeAnnotationType = CreateAnnotationType(modb, DotNetTypeWrapper.GenericAttributeAnnotationTypeName);
			genericAttributeAnnotationMultipleType = CreateAnnotationType(modb, DotNetTypeWrapper.GenericAttributeAnnotationMultipleTypeName);
			genericAttributeAnnotationReturnValueType = CreateAnnotationType(modb, DotNetTypeWrapper.GenericAttributeAnnotationReturnValueTypeName);
			CreateEnumEnum(modb, loader);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:11,代码来源:FakeTypes.cs

示例2: InlineJsrs

		internal static void InlineJsrs(ClassLoaderWrapper classLoader, MethodWrapper mw, ClassFile classFile, ClassFile.Method m)
		{
			JsrInliner inliner;
			do
			{
				ClassFile.Method.Instruction[] codeCopy = (ClassFile.Method.Instruction[])m.Instructions.Clone();
				InstructionFlags[] flags = new InstructionFlags[codeCopy.Length];
				JsrMethodAnalyzer ma = new JsrMethodAnalyzer(mw, classFile, m, classLoader, flags);
				inliner = new JsrInliner(codeCopy, flags, m, ma);
			} while (inliner.InlineJsrs());
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:11,代码来源:JsrInliner.cs

示例3: Finish

		internal static void Finish(ClassLoaderWrapper loader)
		{
			TypeBuilder tb = (TypeBuilder)genericEnumEnumType;
			TypeWrapper enumTypeWrapper = loader.LoadClassByDottedName("java.lang.Enum");
			enumTypeWrapper.Finish();
			tb.SetParent(enumTypeWrapper.TypeAsBaseType);
			CodeEmitter ilgen = CodeEmitter.Create(tb.DefineConstructor(MethodAttributes.Private, CallingConventions.Standard, new Type[] { Types.String, Types.Int32 }));
			ilgen.Emit(OpCodes.Ldarg_0);
			ilgen.Emit(OpCodes.Ldarg_1);
			ilgen.Emit(OpCodes.Ldarg_2);
			enumTypeWrapper.GetMethodWrapper("<init>", "(Ljava.lang.String;I)V", false).EmitCall(ilgen);
			ilgen.Emit(OpCodes.Ret);
			ilgen.DoEmit();
			genericEnumEnumType = tb.CreateType();
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:FakeTypes.cs

示例4: CreateEnumEnum

		private static void CreateEnumEnum(ModuleBuilder modb, ClassLoaderWrapper loader)
		{
			TypeWrapper enumTypeWrapper = loader.LoadClassByDottedName("java.lang.Enum");
			enumTypeWrapper.Finish();
			TypeBuilder tb = modb.DefineType(DotNetTypeWrapper.GenericEnumEnumTypeName, TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.Public, enumTypeWrapper.TypeAsBaseType);
			GenericTypeParameterBuilder gtpb = tb.DefineGenericParameters("T")[0];
			gtpb.SetBaseTypeConstraint(Types.Enum);
			CodeEmitter ilgen = CodeEmitter.Create(tb.DefineConstructor(MethodAttributes.Private, CallingConventions.Standard, new Type[] { Types.String, Types.Int32 }));
			ilgen.Emit(OpCodes.Ldarg_0);
			ilgen.Emit(OpCodes.Ldarg_1);
			ilgen.Emit(OpCodes.Ldarg_2);
			enumTypeWrapper.GetMethodWrapper("<init>", "(Ljava.lang.String;I)V", false).EmitCall(ilgen);
			ilgen.Emit(OpCodes.Ret);
			genericEnumEnumType = tb.CreateType();
		}
开发者ID:ikvm,项目名称:IKVM.NET-cvs-clone,代码行数:15,代码来源:FakeTypes.cs

示例5: GetTypeForMapXml

		internal static Type GetTypeForMapXml(ClassLoaderWrapper loader, string name)
		{
			Type type = GetType(loader, name);
			if (type == null)
			{
				throw new FatalCompilerErrorException(Message.MapFileTypeNotFound, name);
			}
			return type;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:9,代码来源:CompilerClassLoader.cs

示例6: Apply

				internal override void Apply(ClassLoaderWrapper loader, PropertyBuilder pb, object annotation)
				{
					if (type.IsSubclassOf(Types.SecurityAttribute))
					{
						// you can't add declarative security to a property
					}
					else
					{
						pb.SetCustomAttribute(MakeCustomAttributeBuilder(loader, annotation));
					}
				}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:11,代码来源:DotNetTypeWrapper.cs

示例7: SetParameters

			private static void SetParameters(ClassLoaderWrapper loader, ConstructorBuilder cb, IKVM.Internal.MapXml.Param[] parameters)
			{
				if(parameters != null)
				{
					for(int i = 0; i < parameters.Length; i++)
					{
						ParameterBuilder pb = cb.DefineParameter(i + 1, ParameterAttributes.None, parameters[i].Name);
						if(parameters[i].Attributes != null)
						{
							for(int j = 0; j < parameters[i].Attributes.Length; j++)
							{
								AttributeHelper.SetCustomAttribute(loader, pb, parameters[i].Attributes[j]);
							}
						}
					}
				}
			}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:17,代码来源:CompilerClassLoader.cs

示例8: ApplyReturnValue

					internal override void ApplyReturnValue(ClassLoaderWrapper loader, MethodBuilder mb, ref ParameterBuilder pb, object annotation)
					{
						// TODO make sure the descriptor is correct
						Annotation ann = type.Annotation;
						object[] arr = (object[])annotation;
						for (int i = 2; i < arr.Length; i += 2)
						{
							if ("value".Equals(arr[i]))
							{
								if (pb == null)
								{
									pb = mb.DefineParameter(0, ParameterAttributes.None, null);
								}
								object[] value = (object[])arr[i + 1];
								if (value[0].Equals(AnnotationDefaultAttribute.TAG_ANNOTATION))
								{
									ann.Apply(loader, pb, value);
								}
								else
								{
									for (int j = 1; j < value.Length; j++)
									{
										ann.Apply(loader, pb, value[j]);
									}
								}
								break;
							}
						}
					}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:29,代码来源:DotNetTypeWrapper.cs

示例9: IsEquivalentTo

		// HACK when we're compiling multiple targets with -sharedclassloader, each target will have its own CompilerClassLoader,
		// so we need to consider them equivalent (because they represent the same class loader).
		internal bool IsEquivalentTo(ClassLoaderWrapper other)
		{
			if (this == other)
			{
				return true;
			}
			CompilerClassLoader ccl = other as CompilerClassLoader;
			if (ccl != null && options.sharedclassloader != null && options.sharedclassloader.Contains(ccl))
			{
				if (!internalsVisibleTo.Contains(ccl))
				{
					AddInternalsVisibleToAttribute(ccl);
				}
				return true;
			}
			return false;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:19,代码来源:CompilerClassLoader.cs

示例10: Leave

			internal void Leave(ClassLoaderWrapper prev)
			{
				env.classLoader = prev;
				Leave();
			}
开发者ID:drzo,项目名称:opensim4opencog,代码行数:5,代码来源:JniInterface.cs

示例11: MakeCustomAttributeBuilder

				private CustomAttributeBuilder MakeCustomAttributeBuilder(ClassLoaderWrapper loader, object annotation)
				{
					object[] arr = (object[])annotation;
					ConstructorInfo defCtor;
					ConstructorInfo singleOneArgCtor;
					object ctorArg = null;
					GetConstructors(type, out defCtor, out singleOneArgCtor);
					List<PropertyInfo> properties = new List<PropertyInfo>();
					List<object> propertyValues = new List<object>();
					List<FieldInfo> fields = new List<FieldInfo>();
					List<object> fieldValues = new List<object>();
					for (int i = 2; i < arr.Length; i += 2)
					{
						string name = (string)arr[i];
						if (name == "value" && singleOneArgCtor != null)
						{
							ctorArg = ConvertValue(loader, singleOneArgCtor.GetParameters()[0].ParameterType, arr[i + 1]);
						}
						else
						{
							PropertyInfo pi = type.GetProperty(name, BindingFlags.Public | BindingFlags.Instance);
							if (pi != null)
							{
								properties.Add(pi);
								propertyValues.Add(ConvertValue(loader, pi.PropertyType, arr[i + 1]));
							}
							else
							{
								FieldInfo fi = type.GetField(name, BindingFlags.Public | BindingFlags.Instance);
								if (fi != null)
								{
									fields.Add(fi);
									fieldValues.Add(ConvertValue(loader, fi.FieldType, arr[i + 1]));
								}
							}
						}
					}
					if (ctorArg == null && defCtor == null)
					{
						// TODO required argument is missing
					}
					return new CustomAttributeBuilder(ctorArg == null ? defCtor : singleOneArgCtor,
						ctorArg == null ? new object[0] : new object[] { ctorArg },
						properties.ToArray(),
						propertyValues.ToArray(),
						fields.ToArray(),
						fieldValues.ToArray());
				}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:48,代码来源:DotNetTypeWrapper.cs

示例12: GetClassForMapXml

		internal static TypeWrapper GetClassForMapXml(ClassLoaderWrapper loader, string name)
		{
			TypeWrapper tw = loader.LoadClassByDottedNameFast(name);
			if (tw == null)
			{
				throw new FatalCompilerErrorException(Message.MapFileClassNotFound, name);
			}
			return tw;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:9,代码来源:CompilerClassLoader.cs

示例13: GetType

		internal static Type GetType(ClassLoaderWrapper loader, string name)
		{
			CompilerClassLoader ccl = (CompilerClassLoader)loader;
			return ccl.GetTypeFromReferencedAssembly(name);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:5,代码来源:CompilerClassLoader.cs

示例14: UnloadLibrary

		private unsafe static void UnloadLibrary(long handle, ClassLoaderWrapper loader)
		{
			lock (JniLock)
			{
				Tracer.Info(Tracer.Jni, "Unloading library: handle = 0x{0:X}, class loader = {1}", handle, loader);
				IntPtr p = (IntPtr)handle;
				IntPtr onunload = ikvm_GetProcAddress(p, "JNI_OnUnload", IntPtr.Size * 2);
				if (onunload != IntPtr.Zero)
				{
					Tracer.Info(Tracer.Jni, "Calling JNI_OnUnload on: handle = 0x{0:X}", handle);
					JNI.Frame f = new JNI.Frame();
					ClassLoaderWrapper prevLoader = f.Enter(loader);
					try
					{
						// TODO on Whidbey we should be able to use Marshal.GetDelegateForFunctionPointer to call OnLoad
						ikvm_CallOnLoad(onunload, JavaVM.pJavaVM, null);
					}
					finally
					{
						f.Leave(prevLoader);
					}
				}
				nativeLibraries.Remove(p);
				loader.UnregisterNativeLibrary(p);
				ikvm_FreeLibrary((IntPtr)handle);
			}
		}
开发者ID:drzo,项目名称:opensim4opencog,代码行数:27,代码来源:JniInterface.cs

示例15: Enter

			internal ClassLoaderWrapper Enter(ClassLoaderWrapper loader)
			{
				Enter(([email protected])null);
				ClassLoaderWrapper prev = env.classLoader;
				env.classLoader = loader;
				return prev;
			}
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:JniInterface.cs


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