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


C# RuntimeAssembly类代码示例

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


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

示例1: OnReflectionOnlyNamespaceResolveEvent

 internal static RuntimeAssembly[] OnReflectionOnlyNamespaceResolveEvent(AppDomain appDomain, RuntimeAssembly assembly, string namespaceName)
 {
     EventHandler<NamespaceResolveEventArgs> eventHandler = ReflectionOnlyNamespaceResolve;
     if (eventHandler != null)
     {
         Delegate[] ds = eventHandler.GetInvocationList();
         int len = ds.Length;
         for (int i = 0; i < len; i++)
         {
             NamespaceResolveEventArgs eventArgs = new NamespaceResolveEventArgs(namespaceName, assembly);
             
             ((EventHandler<NamespaceResolveEventArgs>)ds[i])(appDomain, eventArgs);
             
             Collection<Assembly> assembliesCollection = eventArgs.ResolvedAssemblies;
             if (assembliesCollection.Count > 0)
             {
                 RuntimeAssembly[] retAssemblies = new RuntimeAssembly[assembliesCollection.Count];
                 int retIndex = 0;
                 foreach (Assembly asm in assembliesCollection)
                 {
                     retAssemblies[retIndex] = AppDomain.GetRuntimeAssembly(asm);
                     retIndex++;
                 }
                 return retAssemblies;
             }
         }
     }
     
     return null;
 }
开发者ID:l1183479157,项目名称:coreclr,代码行数:30,代码来源:WindowsRuntimeMetadata.cs

示例2: CheckAssembly

 internal static void CheckAssembly(RuntimeAssembly asm, CodeAccessPermission demand)
 {
     PermissionSet set;
     PermissionSet set2;
     asm.GetGrantSet(out set, out set2);
     CheckHelper(set, set2, demand, PermissionToken.GetToken(demand), RuntimeMethodHandleInternal.EmptyHandle, asm, SecurityAction.Demand, true);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CodeAccessSecurityEngine.cs

示例3: RuntimeLibrary

        public RuntimeLibrary(
            string type,
            string name,
            string version,
            string hash,
            IReadOnlyList<RuntimeAssetGroup> runtimeAssemblyGroups,
            IReadOnlyList<RuntimeAssetGroup> nativeLibraryGroups,
            IEnumerable<ResourceAssembly> resourceAssemblies,
            IEnumerable<Dependency> dependencies,
            bool serviceable)
            : base(type, name, version, hash, dependencies, serviceable)
        {
            if (runtimeAssemblyGroups == null)
            {
                throw new ArgumentNullException(nameof(runtimeAssemblyGroups));
            }
            if (nativeLibraryGroups == null)
            {
                throw new ArgumentNullException(nameof(nativeLibraryGroups));
            }
            if (resourceAssemblies == null)
            {
                throw new ArgumentNullException(nameof(resourceAssemblies));
            }
            RuntimeAssemblyGroups = runtimeAssemblyGroups;
            ResourceAssemblies = resourceAssemblies.ToArray();
            NativeLibraryGroups = nativeLibraryGroups;

            Assemblies = new RuntimeAssembly[0];
            NativeLibraries = new string[0];
        }
开发者ID:krytarowski,项目名称:cli,代码行数:31,代码来源:RuntimeLibrary.cs

示例4: StrongName

 internal StrongName(StrongNamePublicKeyBlob blob, string name, System.Version version, Assembly assembly)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_EmptyStrongName"));
     }
     if (blob == null)
     {
         throw new ArgumentNullException("blob");
     }
     if (version == null)
     {
         throw new ArgumentNullException("version");
     }
     RuntimeAssembly assembly2 = assembly as RuntimeAssembly;
     if ((assembly != null) && (assembly2 == null))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), "assembly");
     }
     this.m_publicKeyBlob = blob;
     this.m_name = name;
     this.m_version = version;
     this.m_assembly = assembly2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:StrongName.cs

示例5: AssemblyEvidenceFactory

        /// <summary>
        ///     Create a factory which can generate evidence for the specified assembly
        /// </summary> 
        private AssemblyEvidenceFactory(RuntimeAssembly targetAssembly, PEFileEvidenceFactory peFileFactory)
        { 
            Contract.Assert(targetAssembly != null); 
            Contract.Assert(peFileFactory != null);
 
            m_targetAssembly = targetAssembly;
            m_peFileFactory = peFileFactory;
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:11,代码来源:AssemblyEvidenceFactory.cs

示例6: EventItfInfo

 public EventItfInfo(string strEventItfName, string strSrcItfName, string strEventProviderName, RuntimeAssembly asmImport, RuntimeAssembly asmSrcItf)
 {
     this.m_strEventItfName = strEventItfName;
     this.m_strSrcItfName = strSrcItfName;
     this.m_strEventProviderName = strEventProviderName;
     this.m_asmImport = asmImport;
     this.m_asmSrcItf = asmSrcItf;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:EventItfInfo.cs

示例7: GetCustomAttribute

 internal static TypeForwardedToAttribute[] GetCustomAttribute(RuntimeAssembly assembly)
 {
     Type[] o = null;
     RuntimeAssembly.GetForwardedTypes(assembly.GetNativeHandle(), JitHelpers.GetObjectHandleOnStack<Type[]>(ref o));
     TypeForwardedToAttribute[] attributeArray = new TypeForwardedToAttribute[o.Length];
     for (int i = 0; i < o.Length; i++)
     {
         attributeArray[i] = new TypeForwardedToAttribute(o[i]);
     }
     return attributeArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:TypeForwardedToAttribute.cs

示例8: CaseInsensitiveManifestResourceStreamLookup

 private Stream CaseInsensitiveManifestResourceStreamLookup(RuntimeAssembly satellite, string name)
 {
     StringBuilder builder = new StringBuilder();
     if (this._mediator.LocationInfo != null)
     {
         string str = this._mediator.LocationInfo.Namespace;
         if (str != null)
         {
             builder.Append(str);
             if (name != null)
             {
                 builder.Append(Type.Delimiter);
             }
         }
     }
     builder.Append(name);
     string str2 = builder.ToString();
     CompareInfo compareInfo = CultureInfo.InvariantCulture.CompareInfo;
     string str3 = null;
     foreach (string str4 in satellite.GetManifestResourceNames())
     {
         if (compareInfo.Compare(str4, str2, CompareOptions.IgnoreCase) == 0)
         {
             if (str3 != null)
             {
                 throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_MultipleBlobs", new object[] { str2, satellite.ToString() }));
             }
             str3 = str4;
         }
     }
     if (FrameworkEventSource.IsInitialized)
     {
         if (str3 != null)
         {
             FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str2);
         }
         else
         {
             FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupFailed(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str2);
         }
     }
     if (str3 == null)
     {
         return null;
     }
     bool skipSecurityCheck = (this._mediator.MainAssembly == satellite) && (this._mediator.CallingAssembly == this._mediator.MainAssembly);
     StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;
     Stream stream = satellite.GetManifestResourceStream(str3, ref lookForMyCaller, skipSecurityCheck);
     if ((stream != null) && FrameworkEventSource.IsInitialized)
     {
         FrameworkEventSource.Log.ResourceManagerManifestResourceAccessDenied(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str3);
     }
     return stream;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:54,代码来源:ManifestBasedResourceGroveler.cs

示例9: GetCustomAttribute

        internal static TypeForwardedToAttribute[] GetCustomAttribute(RuntimeAssembly assembly)
        {
            Type[] types = null;
            RuntimeAssembly.GetForwardedTypes(assembly.GetNativeHandle(), JitHelpers.GetObjectHandleOnStack(ref types));

            TypeForwardedToAttribute[] attributes = new TypeForwardedToAttribute[types.Length];
            for (int i = 0; i < types.Length; ++i)
                attributes[i] = new TypeForwardedToAttribute(types[i]);

            return attributes;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:11,代码来源:TypeForwardedToAttribute.cs

示例10: EventItfInfo

 public EventItfInfo(String strEventItfName,
                     String strSrcItfName,
                     String strEventProviderName,
                     RuntimeAssembly asmImport,
                     RuntimeAssembly asmSrcItf)
 {
     m_strEventItfName = strEventItfName;
     m_strSrcItfName = strSrcItfName;
     m_strEventProviderName = strEventProviderName;
     m_asmImport = asmImport;
     m_asmSrcItf = asmSrcItf;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:EventItfInfo.cs

示例11: ThrowSecurityException

#pragma warning disable 618
        private static void ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
#pragma warning restore 618
        {
            AssemblyName asmName = null;
            Evidence asmEvidence = null;
            if (asm != null)
            {
                // Assert here because reflection will check grants and if we fail the check,
                // there will be an infinite recursion that overflows the stack.
                PermissionSet.s_fullTrust.Assert();
                asmName = asm.GetName();
            }
            throw SecurityException.MakeSecurityException(asmName, asmEvidence, granted, refused, rmh, action, demand, permThatFailed);
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:15,代码来源:CodeAccessSecurityEngine.cs

示例12: TryResolve

 public sealed override Exception TryResolve(ReflectionDomain reflectionDomain, RuntimeAssembly currentAssembly, bool ignoreCase, out RuntimeType result)
 {
     result = null;
     if (AssemblyName == null)
     {
         return TypeName.TryResolve(reflectionDomain, currentAssembly, ignoreCase, out result);
     }
     else
     {
         RuntimeAssembly newAssembly;
         Exception assemblyLoadException = RuntimeAssembly.TryGetRuntimeAssembly(reflectionDomain, AssemblyName, out newAssembly);
         if (assemblyLoadException != null)
             return assemblyLoadException;
         return TypeName.TryResolve(reflectionDomain, newAssembly, ignoreCase, out result);
     }
 }
开发者ID:noahfalk,项目名称:corert,代码行数:16,代码来源:TypeName.cs

示例13: Hash

 public Hash(Assembly assembly)
 {
     if (assembly == null)
     {
         throw new ArgumentNullException("assembly");
     }
     if (assembly.IsDynamic)
     {
         throw new ArgumentException(Environment.GetResourceString("Security_CannotGenerateHash"), "assembly");
     }
     this.m_hashes = new Dictionary<Type, byte[]>();
     this.m_assembly = assembly as RuntimeAssembly;
     if (this.m_assembly == null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), "assembly");
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:Hash.cs

示例14: ResourceManager

 public ResourceManager(Type resourceSource)
 {
     if (null == resourceSource)
     {
         throw new ArgumentNullException("resourceSource");
     }
     if (!(resourceSource is RuntimeType))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
     }
     this._locationInfo = resourceSource;
     this.MainAssembly = this._locationInfo.Assembly;
     this.BaseNameField = resourceSource.Name;
     this.CommonSatelliteAssemblyInit();
     this.m_callingAssembly = (RuntimeAssembly) Assembly.GetCallingAssembly();
     if ((this.MainAssembly == typeof(object).Assembly) && (this.m_callingAssembly != this.MainAssembly))
     {
         this.m_callingAssembly = null;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:ResourceManager.cs

示例15: CreateAssemblyName

        [System.Security.SecurityCritical]  // auto-generated
        internal static AssemblyName CreateAssemblyName(
            String assemblyString, 
            bool forIntrospection, 
            out RuntimeAssembly assemblyFromResolveEvent)
        {
            if (assemblyString == null)
                throw new ArgumentNullException("assemblyString");
            Contract.EndContractBlock();

            if ((assemblyString.Length == 0) ||
                (assemblyString[0] == '\0'))
                throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));

            if (forIntrospection)
                AppDomain.CheckReflectionOnlyLoadSupported();

            AssemblyName an = new AssemblyName();

            an.Name = assemblyString;
            assemblyFromResolveEvent = null; // instead of an.nInit(out assemblyFromResolveEvent, forIntrospection, true);
            return an;
        }
开发者ID:jamescourtney,项目名称:mono,代码行数:23,代码来源:MonoAssembly.cs


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