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


C# TypeWrapper.GetClassLoader方法代码示例

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


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

示例1: AddAutomagicSerialization

		internal static ConstructorInfo AddAutomagicSerialization(TypeWrapper wrapper)
		{
			ConstructorInfo serializationCtor = null;
			if (wrapper.GetClassLoader().NoAutomagicSerialization)
			{
				// do nothing
			}
			else if ((wrapper.Modifiers & IKVM.Attributes.Modifiers.Enum) != 0)
			{
				MarkSerializable(wrapper);
			}
			else if (wrapper.IsSubTypeOf(serializable) && IsSafeForAutomagicSerialization(wrapper))
			{
				if (wrapper.IsSubTypeOf(externalizable))
				{
					MethodWrapper ctor = wrapper.GetMethodWrapper("<init>", "()V", false);
					if (ctor != null && ctor.IsPublic)
					{
						MarkSerializable(wrapper);
						ctor.Link();
						serializationCtor = AddConstructor(wrapper.TypeAsBuilder, ctor, null, true);
						if (!wrapper.BaseTypeWrapper.IsSubTypeOf(serializable))
						{
							AddGetObjectData(wrapper);
						}
						if (wrapper.BaseTypeWrapper.GetMethodWrapper("readResolve", "()Ljava.lang.Object;", true) != null)
						{
							RemoveReadResolve(wrapper);
						}
					}
				}
				else if (wrapper.BaseTypeWrapper.IsSubTypeOf(serializable))
				{
					ConstructorInfo baseCtor = wrapper.GetBaseSerializationConstructor();
					if (baseCtor != null && (baseCtor.IsFamily || baseCtor.IsFamilyOrAssembly))
					{
						MarkSerializable(wrapper);
						serializationCtor = AddConstructor(wrapper.TypeAsBuilder, null, baseCtor, false);
						AddReadResolve(wrapper);
					}
				}
				else
				{
					MethodWrapper baseCtor = wrapper.BaseTypeWrapper.GetMethodWrapper("<init>", "()V", false);
					if (baseCtor != null && baseCtor.IsAccessibleFrom(wrapper.BaseTypeWrapper, wrapper, wrapper))
					{
						MarkSerializable(wrapper);
						AddGetObjectData(wrapper);
#if STATIC_COMPILER
						// because the base type can be a __WorkaroundBaseClass__, we may need to replace the constructor
						baseCtor = ((AotTypeWrapper)wrapper).ReplaceMethodWrapper(baseCtor);
#endif
						baseCtor.Link();
						serializationCtor = AddConstructor(wrapper.TypeAsBuilder, baseCtor, null, true);
						AddReadResolve(wrapper);
					}
				}
			}
			return serializationCtor;
		}
开发者ID:ikvm,项目名称:IKVM.NET-cvs-clone,代码行数:60,代码来源:Serialization.cs

示例2: InternalsVisibleToImpl

 internal override bool InternalsVisibleToImpl(TypeWrapper wrapper, TypeWrapper friend)
 {
     ClassLoaderWrapper other = friend.GetClassLoader();
     if (this == other)
     {
         return true;
     }
     AssemblyName otherName;
     #if STATIC_COMPILER
     CompilerClassLoader ccl = other as CompilerClassLoader;
     if (ccl == null)
     {
         return false;
     }
     otherName = ccl.GetAssemblyName();
     #else
     AssemblyClassLoader acl = other as AssemblyClassLoader;
     if (acl == null)
     {
         return false;
     }
     otherName = acl.GetAssembly(friend).GetName();
     #endif
     return GetLoader(GetAssembly(wrapper)).InternalsVisibleTo(otherName);
 }
开发者ID:LogosBible,项目名称:ikvm-fork,代码行数:25,代码来源:AssemblyClassLoader.cs

示例3: GetAssembly

 internal Assembly GetAssembly(TypeWrapper wrapper)
 {
     Debug.Assert(wrapper.GetClassLoader() == this);
     while (wrapper.IsFakeNestedType)
     {
         wrapper = wrapper.DeclaringTypeWrapper;
     }
     return wrapper.TypeAsBaseType.Assembly;
 }
开发者ID:LogosBible,项目名称:ikvm-fork,代码行数:9,代码来源:AssemblyClassLoader.cs

示例4: InternalsVisibleToImpl

		internal override bool InternalsVisibleToImpl(TypeWrapper wrapper, TypeWrapper friend)
		{
			Debug.Assert(wrapper.GetClassLoader() == this);
			ClassLoaderWrapper other = friend.GetClassLoader();
			// TODO ideally we should also respect InternalsVisibleToAttribute.Annotation here
			if (this == other || internalsVisibleTo.Contains(other))
			{
				return true;
			}
			CompilerClassLoader ccl = other as CompilerClassLoader;
			if (ccl != null)
			{
				AddInternalsVisibleToAttribute(ccl);
				return true;
			}
			return false;
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:17,代码来源:CompilerClassLoader.cs

示例5: AssemblyQualifiedName

		private static string AssemblyQualifiedName(TypeWrapper tw)
		{
			ClassLoaderWrapper loader = tw.GetClassLoader();
			AssemblyClassLoader acl = loader as AssemblyClassLoader;
			if(acl != null)
			{
				return tw.Name + ", " + acl.GetAssembly(tw).FullName;
			}
			CompilerClassLoader ccl = loader as CompilerClassLoader;
			if(ccl != null)
			{
				return tw.Name + ", " + ccl.GetTypeWrapperFactory().ModuleBuilder.Assembly.FullName;
			}
			return tw.Name + " (unknown assembly)";
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:CompilerClassLoader.cs

示例6: Link

			internal override void Link(TypeWrapper thisType)
			{
				lock (this)
				{
					if (argTypeWrappers != null)
					{
						return;
					}
				}
				ClassLoaderWrapper classLoader = thisType.GetClassLoader();
				TypeWrapper[] args = classLoader.ArgTypeWrapperListFromSigNoThrow(descriptor);
				TypeWrapper ret = classLoader.RetTypeWrapperFromSigNoThrow(descriptor);
				lock (this)
				{
					if (argTypeWrappers == null)
					{
						argTypeWrappers = args;
						retTypeWrapper = ret;
					}
				}
			}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:21,代码来源:ClassFile.cs

示例7: GetAssemblyName

 private static string GetAssemblyName(TypeWrapper tw)
 {
     ClassLoaderWrapper loader = tw.GetClassLoader();
     AssemblyClassLoader acl = loader as AssemblyClassLoader;
     if (acl != null)
     {
         return acl.GetAssembly(tw).FullName;
     }
     else
     {
         return ((GenericClassLoaderWrapper)loader).GetName();
     }
 }
开发者ID:T0pp3r,项目名称:ikvm-fork,代码行数:13,代码来源:StubGenerator.cs

示例8: InternalsVisibleToImpl

 internal override bool InternalsVisibleToImpl(TypeWrapper wrapper, TypeWrapper friend)
 {
     ClassLoaderWrapper other = friend.GetClassLoader();
     if (this == other)
     {
     #if STATIC_COMPILER || STUB_GENERATOR
         return true;
     #else
         // we're OK if the type being accessed (wrapper) is a dynamic type
         // or if the dynamic assembly has internal access
         return GetAssembly(wrapper).Equals(GetTypeWrapperFactory().ModuleBuilder.Assembly)
             || GetTypeWrapperFactory().HasInternalAccess;
     #endif
     }
     AssemblyName otherName;
     #if STATIC_COMPILER
     CompilerClassLoader ccl = other as CompilerClassLoader;
     if (ccl == null)
     {
         return false;
     }
     otherName = ccl.GetAssemblyName();
     #else
     AssemblyClassLoader acl = other as AssemblyClassLoader;
     if (acl == null)
     {
         return false;
     }
     otherName = acl.GetAssembly(friend).GetName();
     #endif
     return GetLoader(GetAssembly(wrapper)).InternalsVisibleTo(otherName);
 }
开发者ID:xamidi,项目名称:ikvm,代码行数:32,代码来源:AssemblyClassLoader.cs

示例9: IsEnabled

        internal static bool IsEnabled(TypeWrapper tw)
        {
            string className = tw.Name;

            // match class name
            for (OptionNode n = classes; n != null; n = n.next)
            {
                if (n.name == className)
                {
                    return n.enabled;
                }
            }

            // match package name
            if (packages != null)
            {
                int len = className.Length;
                while (len > 0 && className[--len] != '.') ;

                do
                {
                    for (OptionNode n = packages; n != null; n = n.next)
                    {
                        if (String.Compare(n.name, 0, className, 0, len, false, CultureInfo.InvariantCulture) == 0 && len == n.name.Length)
                        {
                            return n.enabled;
                        }
                    }
                    while (len > 0 && className[--len] != '.') ;
                } while (len > 0);
            }

            return tw.GetClassLoader() == ClassLoaderWrapper.GetBootstrapClassLoader() ? sysAsserts : userAsserts;
        }
开发者ID:somexotherxguy,项目名称:ikvm,代码行数:34,代码来源:Assertions.cs

示例10: TryGet

        internal static bool TryGet(TypeWrapper wrapper, PropertyInfo property, out FieldWrapper accessStub)
        {
            NameSigAttribute nameSig = AttributeHelper.GetNameSig(property);
            bool hideFromReflection = AttributeHelper.IsHideFromReflection(property);

            if (nameSig != null || hideFromReflection)
            {
                TypeWrapper type;
                string name;
                string sig;
                if (nameSig == null)
                {
                    type = ClassLoaderWrapper.GetWrapperFromType(property.PropertyType);
                    name = property.Name;
                    sig = type.SigName;
                }
                else
                {
                    type = wrapper.GetClassLoader().FieldTypeWrapperFromSigNoThrow(nameSig.Sig);
                    name = nameSig.Name;
                    sig = nameSig.Sig;
                }
                Modifiers modifiers;
                MemberFlags flags = MemberFlags.AccessStub;
                if (hideFromReflection)
                {
                    // it's a Type 1 access stub (to make inherited fields visible)
                    flags |= MemberFlags.HideFromReflection;
                    modifiers = GetModifiers(property);
                }
                else
                {
                    // it's a Type 2 access stub (to make fields that have a non-public field type visible)
                    ModifiersAttribute attr = AttributeHelper.GetModifiersAttribute(property);
                    modifiers = attr.Modifiers;
                    if (attr.IsInternal)
                    {
                        flags |= MemberFlags.InternalAccess;
                    }
                }
                accessStub = new CompiledAccessStubFieldWrapper(wrapper, property, type, name, sig, modifiers, flags);
                return true;
            }
            else
            {
                accessStub = null;
                return false;
            }
        }
开发者ID:badlogic,项目名称:ikvm-monotouch,代码行数:49,代码来源:MemberWrapper.cs


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