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


C# AssemblyName.Clone方法代码示例

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


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

示例1: Clone

        public static void Clone()
        {
            AssemblyName an1 = new AssemblyName("MyAssemblyName");
            an1.Flags = AssemblyNameFlags.PublicKey | AssemblyNameFlags.EnableJITcompileOptimizer;

            object an2 = an1.Clone();
            Assert.Equal(an1.FullName, ((AssemblyName)an2).FullName);
            Assert.Equal(AssemblyNameFlags.PublicKey | AssemblyNameFlags.EnableJITcompileOptimizer, ((AssemblyName)an2).Flags);
        }
开发者ID:alessandromontividiu03,项目名称:corefx,代码行数:9,代码来源:AssemblyNameTests.cs

示例2: InternalLoadAssemblyName

        [System.Security.SecurityCritical]  // auto-generated
        internal static RuntimeAssembly InternalLoadAssemblyName(
            AssemblyName assemblyRef, 
            Evidence assemblySecurity,
            RuntimeAssembly reqAssembly,
            ref StackCrawlMark stackMark,
#if FEATURE_HOSTED_BINDER
            IntPtr pPrivHostBinder,
#endif
            bool throwOnFileNotFound, 
            bool forIntrospection,
            bool suppressSecurityChecks)
        {
       
            if (assemblyRef == null)
                throw new ArgumentNullException("assemblyRef");
            Contract.EndContractBlock();

            if (assemblyRef.CodeBase != null)
            {
                AppDomain.CheckLoadFromSupported();
            }

            assemblyRef = (AssemblyName)assemblyRef.Clone();
#if FEATURE_VERSIONING
            if (!forIntrospection &&
                (assemblyRef.ProcessorArchitecture != ProcessorArchitecture.None)) {
                // PA does not have a semantics for by-name binds for execution
                assemblyRef.ProcessorArchitecture = ProcessorArchitecture.None;
            }
#endif

            if (assemblySecurity != null)
            {
#if FEATURE_CAS_POLICY
                if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
                {
                    throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
                }
#endif // FEATURE_CAS_POLICY

                if (!suppressSecurityChecks)
                {
#pragma warning disable 618
                    new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618
                }
            }


            String codeBase = VerifyCodeBase(assemblyRef.CodeBase);
            if (codeBase != null && !suppressSecurityChecks) {
                
                if (String.Compare( codeBase, 0, s_localFilePrefix, 0, 5, StringComparison.OrdinalIgnoreCase) != 0) {
#if FEATURE_FUSION   // Of all the binders, Fusion is the only one that understands Web locations                 
                    IPermission perm = CreateWebPermission( assemblyRef.EscapedCodeBase );
                    perm.Demand();
#else
                     throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileName"), "assemblyRef.CodeBase");
#endif
                }
                else {
                    System.Security.Util.URLString urlString = new System.Security.Util.URLString( codeBase, true );
                    new FileIOPermission( FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read , urlString.GetFileName() ).Demand();
                }   
            }

            return nLoad(assemblyRef, codeBase, assemblySecurity, reqAssembly, ref stackMark,
#if FEATURE_HOSTED_BINDER
                pPrivHostBinder,
#endif
                throwOnFileNotFound, forIntrospection, suppressSecurityChecks);
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:73,代码来源:Assembly.cs

示例3: InternalLoadAssemblyName

        internal static RuntimeAssembly InternalLoadAssemblyName(
            AssemblyName assemblyRef, 
            Evidence assemblySecurity,
            RuntimeAssembly reqAssembly,
            ref StackCrawlMark stackMark,
#if FEATURE_HOSTED_BINDER
            IntPtr pPrivHostBinder,
#endif
            bool throwOnFileNotFound, 
            bool forIntrospection,
            bool suppressSecurityChecks)
        {
            if (assemblyRef == null)
                throw new ArgumentNullException("assemblyRef");
            Contract.EndContractBlock();

            if (assemblyRef.CodeBase != null)
            {
                AppDomain.CheckLoadFromSupported();
            }

            assemblyRef = (AssemblyName)assemblyRef.Clone();
#if FEATURE_VERSIONING
            if (!forIntrospection &&
                (assemblyRef.ProcessorArchitecture != ProcessorArchitecture.None)) {
                // PA does not have a semantics for by-name binds for execution
                assemblyRef.ProcessorArchitecture = ProcessorArchitecture.None;
            }
#endif

            if (assemblySecurity != null)
            {
#if FEATURE_CAS_POLICY
                if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
                {
                    throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
                }
#endif // FEATURE_CAS_POLICY

                if (!suppressSecurityChecks)
                {
#pragma warning disable 618
                    new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618
                }
            }

			return (RuntimeAssembly) Assembly.Load (assemblyRef);
		}
开发者ID:jamescourtney,项目名称:mono,代码行数:49,代码来源:MonoAssembly.cs

示例4: InternalLoad

        internal static Assembly InternalLoad(AssemblyName assemblyRef, bool stringized,
                                              Evidence assemblySecurity, ref StackCrawlMark stackMark)
        {
       
            if (assemblyRef == null)
                throw new ArgumentNullException("assemblyRef");

            assemblyRef=(AssemblyName)assemblyRef.Clone();

            if (assemblySecurity != null)
                new SecurityPermission( SecurityPermissionFlag.ControlEvidence ).Demand();

            String codeBase = AppDomain.VerifyCodeBase(assemblyRef.CodeBase);
            if (codeBase != null) {

                if (String.Compare( codeBase, 0, s_localFilePrefix, 0, 5, true, CultureInfo.InvariantCulture) != 0) {
                    IPermission perm = CreateWebPermission( assemblyRef.EscapedCodeBase );

                    if (perm == null) {
                        BCLDebug.Assert( false, "Unable to create System.Net.WebPermission" );
                        return null;
                    }

                    perm.Demand();
                }
                else {
                    System.Security.Util.URLString urlString = new System.Security.Util.URLString( codeBase, true );
                    new FileIOPermission( FileIOPermissionAccess.Read, urlString.GetFileName() ).Demand();
                }   
            }

            return nLoad(assemblyRef, codeBase, stringized, assemblySecurity, true, null, ref stackMark);
        }
开发者ID:ArildF,项目名称:masters,代码行数:33,代码来源:assembly.cs

示例5: InternalLoadAssemblyName

 internal static RuntimeAssembly InternalLoadAssemblyName(AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, ref StackCrawlMark stackMark, bool forIntrospection, bool suppressSecurityChecks)
 {
     if (assemblyRef == null)
     {
         throw new ArgumentNullException("assemblyRef");
     }
     assemblyRef = (AssemblyName) assemblyRef.Clone();
     if (assemblySecurity != null)
     {
         if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
         {
             throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
         }
         if (!suppressSecurityChecks)
         {
             new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
         }
     }
     string strA = VerifyCodeBase(assemblyRef.CodeBase);
     if ((strA != null) && !suppressSecurityChecks)
     {
         if (string.Compare(strA, 0, "file:", 0, 5, StringComparison.OrdinalIgnoreCase) != 0)
         {
             CreateWebPermission(assemblyRef.EscapedCodeBase).Demand();
         }
         else
         {
             URLString str2 = new URLString(strA, true);
             new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, str2.GetFileName()).Demand();
         }
     }
     return nLoad(assemblyRef, strA, assemblySecurity, null, ref stackMark, true, forIntrospection, suppressSecurityChecks);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:RuntimeAssembly.cs

示例6: AssemblyBuilder

        [System.Security.SecurityCritical]  // auto-generated
        internal AssemblyBuilder(AppDomain domain,
                                 AssemblyName name,
                                 AssemblyBuilderAccess access,
                                 String dir,
                                 Evidence evidence,
                                 PermissionSet requiredPermissions,
                                 PermissionSet optionalPermissions,
                                 PermissionSet refusedPermissions,
                                 ref StackCrawlMark stackMark,
                                 IEnumerable<CustomAttributeBuilder> unsafeAssemblyAttributes,
                                 SecurityContextSource securityContextSource)
        {
            if (name == null)
                throw new ArgumentNullException("name");

            if (access != AssemblyBuilderAccess.Run
#if !FEATURE_CORECLR
                && access != AssemblyBuilderAccess.Save
                && access != AssemblyBuilderAccess.RunAndSave
#endif // !FEATURE_CORECLR
#if FEATURE_REFLECTION_ONLY_LOAD
                && access != AssemblyBuilderAccess.ReflectionOnly
#endif // FEATURE_REFLECTION_ONLY_LOAD
#if FEATURE_COLLECTIBLE_TYPES
                && access != AssemblyBuilderAccess.RunAndCollect
#endif // FEATURE_COLLECTIBLE_TYPES
                )
            {
                throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)access), "access");
            }

            if (securityContextSource < SecurityContextSource.CurrentAppDomain ||
                securityContextSource > SecurityContextSource.CurrentAssembly)
            {
                throw new ArgumentOutOfRangeException("securityContextSource");
            }

            // Clone the name in case the caller modifies it underneath us.
            name = (AssemblyName)name.Clone();
            
#if !FEATURE_CORECLR
            // Set the public key from the key pair if one has been provided.
            // (Overwite any public key in the Assembly name, since it's no
            // longer valid to have a disparity).
            if (name.KeyPair != null)
                name.SetPublicKey(name.KeyPair.PublicKey);
#endif

            // If the caller is trusted they can supply identity
            // evidence for the new assembly. Otherwise we copy the
            // current grant and deny sets from the caller's assembly,
            // inject them into the new assembly and mark policy as
            // resolved. If/when the assembly is persisted and
            // reloaded, the normal rules for gathering evidence will
            // be used.
            if (evidence != null)
#pragma warning disable 618
                new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618

#if FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR
            // Collectible assemblies require FullTrust. This demand may be removed if we deem the
            // feature robust enough to be used directly by untrusted API consumers.
            if (access == AssemblyBuilderAccess.RunAndCollect)
                new PermissionSet(PermissionState.Unrestricted).Demand();
#endif // FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR

            // Scan the assembly level attributes for any attributes which modify how we create the
            // assembly. Currently, we look for any attribute which modifies the security transparency
            // of the assembly.
            List<CustomAttributeBuilder> assemblyAttributes = null;
            DynamicAssemblyFlags assemblyFlags = DynamicAssemblyFlags.None;
            byte[] securityRulesBlob = null;
            byte[] aptcaBlob = null;
            if (unsafeAssemblyAttributes != null)
            {
                // Create a copy to ensure that it cannot be modified from another thread
                // as it is used further below.
                assemblyAttributes = new List<CustomAttributeBuilder>(unsafeAssemblyAttributes);

#pragma warning disable 618 // We deal with legacy attributes here as well for compat
                foreach (CustomAttributeBuilder attribute in assemblyAttributes)
                {
                    if (attribute.m_con.DeclaringType == typeof(SecurityTransparentAttribute))
                    {
                        assemblyFlags |= DynamicAssemblyFlags.Transparent;
                    }
                    else if (attribute.m_con.DeclaringType == typeof(SecurityCriticalAttribute))
                    {
#if !FEATURE_CORECLR
                        SecurityCriticalScope scope = SecurityCriticalScope.Everything;
                        if (attribute.m_constructorArgs != null &&
                            attribute.m_constructorArgs.Length == 1 &&
                            attribute.m_constructorArgs[0] is SecurityCriticalScope)
                        {
                            scope = (SecurityCriticalScope)attribute.m_constructorArgs[0];
                        }

                        assemblyFlags |= DynamicAssemblyFlags.Critical;
//.........这里部分代码省略.........
开发者ID:ChuangYang,项目名称:coreclr,代码行数:101,代码来源:AssemblyBuilder.cs

示例7: Clone_Self

	public void Clone_Self ()
	{
		an = Assembly.GetExecutingAssembly ().GetName ();
		AssemblyName clone = (AssemblyName) an.Clone ();

		Assert.AreEqual (an.CodeBase, clone.CodeBase, "CodeBase");
		Assert.AreEqual (an.CultureInfo, clone.CultureInfo, "CultureInfo");
		Assert.AreEqual (an.EscapedCodeBase, clone.EscapedCodeBase, "EscapedCodeBase");
		Assert.AreEqual (an.Flags, clone.Flags, "Flags");
		Assert.AreEqual (an.FullName, clone.FullName, "FullName");
		Assert.AreEqual (an.HashAlgorithm, clone.HashAlgorithm, "HashAlgorithm");
		Assert.AreEqual (an.KeyPair, clone.KeyPair, "KeyPair");
		Assert.AreEqual (an.Name, clone.Name, "Name");
#if NET_2_0
		//Assert.AreEqual (ProcessorArchitecture.MSIL, clone.ProcessorArchitecture, "PA");
#endif
		Assert.AreEqual (an.Version, clone.Version, "Version");
		Assert.AreEqual (an.VersionCompatibility, clone.VersionCompatibility, "VersionCompatibility");
		Assert.AreEqual (an.GetPublicKey (), clone.GetPublicKey (), "GetPublicKey");
		Assert.AreEqual (an.GetPublicKeyToken (), clone.GetPublicKeyToken (), "GetPublicKeyToken");
		Assert.AreEqual (an.ToString (), clone.ToString (), "ToString");
	}
开发者ID:wamiq,项目名称:debian-mono,代码行数:22,代码来源:AssemblyNameTest.cs

示例8: LoadAssembly

            static Assembly LoadAssembly(AssemblyName name)
            {
                Assembly result = null;

                try
                {
                    _logger.DebugFormat("Loading assembly '{0}'.", name);
                    result = Assembly.Load(name);
                }
                catch (FileLoadException)
                {
                    _logger.DebugFormat("Cannot load assembly '{0}'.", name);
                }

                if (result == null && name.Version != null)
                {
                    var nameWithoutVersion = (AssemblyName)name.Clone();
                    nameWithoutVersion.Version = null;

                    result = LoadAssembly(nameWithoutVersion);
                }

                return result;
            }
开发者ID:lorenzonet,项目名称:vc-community,代码行数:24,代码来源:VirtoCommercePlatformWebBootstrapper.cs

示例9: Clone_Empty

	public void Clone_Empty ()
	{
		an = new AssemblyName ();
		AssemblyName clone = (AssemblyName) an.Clone ();

		Assert.IsNull (clone.CodeBase, "CodeBase");
		Assert.IsNull (clone.CultureInfo, "CultureInfo");
		Assert.IsNull (clone.EscapedCodeBase, "EscapedCodeBase");
		Assert.AreEqual (AssemblyNameFlags.None, clone.Flags, "Flags");
#if NET_2_0
		Assert.AreEqual (String.Empty, clone.FullName, "FullName");
#else
		Assert.IsNull (clone.FullName, "FullName");
#endif
		Assert.AreEqual (AssemblyHashAlgorithm.None, clone.HashAlgorithm, "HashAlgorithm");
		Assert.IsNull (clone.KeyPair, "KeyPair");
		Assert.IsNull (clone.Name, "Name");
#if NET_2_0
		Assert.AreEqual (ProcessorArchitecture.None, clone.ProcessorArchitecture, "PA");
#endif
		Assert.IsNull (clone.Version, "Version");
		Assert.AreEqual (AssemblyVersionCompatibility.SameMachine, 
			clone.VersionCompatibility, "VersionCompatibility");
	}
开发者ID:wamiq,项目名称:debian-mono,代码行数:24,代码来源:AssemblyNameTest.cs

示例10: Clone_Corlib

	public void Clone_Corlib ()
	{
		an = typeof (int).Assembly.GetName ();
		AssemblyName clone = (AssemblyName) an.Clone ();

		Assert.AreEqual (an.CodeBase, clone.CodeBase, "CodeBase");
		Assert.AreEqual (an.CultureInfo, clone.CultureInfo, "CultureInfo");
		Assert.AreEqual (an.EscapedCodeBase, clone.EscapedCodeBase, "EscapedCodeBase");
		Assert.AreEqual (an.Flags, clone.Flags, "Flags");
		Assert.AreEqual (an.FullName, clone.FullName, "FullName");
		Assert.AreEqual (an.HashAlgorithm, clone.HashAlgorithm, "HashAlgorithm");
		Assert.AreEqual (an.KeyPair, clone.KeyPair, "KeyPair");
		Assert.AreEqual (an.Name, clone.Name, "Name");
		//Assert.AreEqual (an.ProcessorArchitecture, clone.ProcessorArchitecture, "PA");
		Assert.AreEqual (an.Version, clone.Version, "Version");
		Assert.AreEqual (an.VersionCompatibility, clone.VersionCompatibility, "VersionCompatibility");
		Assert.AreEqual (an.GetPublicKey (), clone.GetPublicKey (), "GetPublicKey");
		Assert.AreEqual (an.GetPublicKeyToken (), clone.GetPublicKeyToken (), "GetPublicKeyToken");
		Assert.AreEqual (an.ToString (), clone.ToString (), "ToString");
	}
开发者ID:frje,项目名称:SharpLang,代码行数:20,代码来源:AssemblyNameTest.cs

示例11: AssemblyBuilder

        internal AssemblyBuilder(AppDomain domain,
                                 AssemblyName name,
                                 AssemblyBuilderAccess access,
                                 String dir,
                                 Evidence evidence,
                                 PermissionSet requiredPermissions,
                                 PermissionSet optionalPermissions,
                                 PermissionSet refusedPermissions,
                                 ref StackCrawlMark stackMark,
                                 IEnumerable<CustomAttributeBuilder> unsafeAssemblyAttributes,
                                 SecurityContextSource securityContextSource)
        {
            if (name == null)
                throw new ArgumentNullException(nameof(name));

            if (access != AssemblyBuilderAccess.Run
#if FEATURE_REFLECTION_ONLY_LOAD
                && access != AssemblyBuilderAccess.ReflectionOnly
#endif // FEATURE_REFLECTION_ONLY_LOAD
#if FEATURE_COLLECTIBLE_TYPES
                && access != AssemblyBuilderAccess.RunAndCollect
#endif // FEATURE_COLLECTIBLE_TYPES
                )
            {
                throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)access), nameof(access));
            }

            if (securityContextSource < SecurityContextSource.CurrentAppDomain ||
                securityContextSource > SecurityContextSource.CurrentAssembly)
            {
                throw new ArgumentOutOfRangeException(nameof(securityContextSource));
            }

            // Clone the name in case the caller modifies it underneath us.
            name = (AssemblyName)name.Clone();

            // If the caller is trusted they can supply identity
            // evidence for the new assembly. Otherwise we copy the
            // current grant and deny sets from the caller's assembly,
            // inject them into the new assembly and mark policy as
            // resolved. If/when the assembly is persisted and
            // reloaded, the normal rules for gathering evidence will
            // be used.
            if (evidence != null)
#pragma warning disable 618
                new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618

            // Scan the assembly level attributes for any attributes which modify how we create the
            // assembly. Currently, we look for any attribute which modifies the security transparency
            // of the assembly.
            List<CustomAttributeBuilder> assemblyAttributes = null;
            DynamicAssemblyFlags assemblyFlags = DynamicAssemblyFlags.None;
            byte[] securityRulesBlob = null;
            byte[] aptcaBlob = null;
            if (unsafeAssemblyAttributes != null)
            {
                // Create a copy to ensure that it cannot be modified from another thread
                // as it is used further below.
                assemblyAttributes = new List<CustomAttributeBuilder>(unsafeAssemblyAttributes);

#pragma warning disable 618 // We deal with legacy attributes here as well for compat
                foreach (CustomAttributeBuilder attribute in assemblyAttributes)
                {
                    if (attribute.m_con.DeclaringType == typeof(SecurityTransparentAttribute))
                    {
                        assemblyFlags |= DynamicAssemblyFlags.Transparent;
                    }
                    else if (attribute.m_con.DeclaringType == typeof(SecurityCriticalAttribute))
                    {
                        {
                            assemblyFlags |= DynamicAssemblyFlags.AllCritical;
                        }
                    }
                }
#pragma warning restore 618
            }

            m_internalAssemblyBuilder = (InternalAssemblyBuilder)nCreateDynamicAssembly(domain,
                                                                                        name,
                                                                                        evidence,
                                                                                        ref stackMark,
                                                                                        requiredPermissions,
                                                                                        optionalPermissions,
                                                                                        refusedPermissions,
                                                                                        securityRulesBlob,
                                                                                        aptcaBlob,
                                                                                        access,
                                                                                        assemblyFlags,
                                                                                        securityContextSource);

            m_assemblyData = new AssemblyBuilderData(m_internalAssemblyBuilder,
                                                     name.Name,
                                                     access,
                                                     dir);
            m_assemblyData.AddPermissionRequests(requiredPermissions,
                                                 optionalPermissions,
                                                 refusedPermissions);

#if FEATURE_APPX
//.........这里部分代码省略.........
开发者ID:kouvel,项目名称:coreclr,代码行数:101,代码来源:AssemblyBuilder.cs

示例12: InternalLoad

 internal static Assembly InternalLoad(AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, ref StackCrawlMark stackMark, bool forIntrospection)
 {
     if (assemblyRef == null)
     {
         throw new ArgumentNullException("assemblyRef");
     }
     assemblyRef = (AssemblyName) assemblyRef.Clone();
     if (assemblySecurity != null)
     {
         new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
     }
     string strA = VerifyCodeBase(assemblyRef.CodeBase);
     if (strA != null)
     {
         if (string.Compare(strA, 0, "file:", 0, 5, StringComparison.OrdinalIgnoreCase) != 0)
         {
             CreateWebPermission(assemblyRef.EscapedCodeBase).Demand();
         }
         else
         {
             URLString str2 = new URLString(strA, true);
             new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, str2.GetFileName()).Demand();
         }
     }
     return nLoad(assemblyRef, strA, assemblySecurity, null, ref stackMark, true, forIntrospection);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:26,代码来源:Assembly.cs

示例13: InternalLoad

        internal static Assembly InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity,
                                              ref StackCrawlMark stackMark, bool forIntrospection)
        {
       
            if (assemblyRef == null)
                throw new ArgumentNullException("assemblyRef");

            assemblyRef = (AssemblyName)assemblyRef.Clone();
            if (assemblySecurity != null)
                new SecurityPermission( SecurityPermissionFlag.ControlEvidence ).Demand();

            String codeBase = VerifyCodeBase(assemblyRef.CodeBase);
            if (codeBase != null) {
                
                if (String.Compare( codeBase, 0, s_localFilePrefix, 0, 5, StringComparison.OrdinalIgnoreCase) != 0) {
                    IPermission perm = CreateWebPermission( assemblyRef.EscapedCodeBase );
                    perm.Demand();
                }
                else {
                    System.Security.Util.URLString urlString = new System.Security.Util.URLString( codeBase, true );
                    new FileIOPermission( FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read , urlString.GetFileName() ).Demand();
                }   
            }

            return nLoad(assemblyRef, codeBase, assemblySecurity, null, ref stackMark, true, forIntrospection);
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:26,代码来源:assembly.cs

示例14: Clone_Self

	public void Clone_Self ()
	{
		an = Assembly.GetExecutingAssembly ().GetName ();
		AssemblyName clone = (AssemblyName) an.Clone ();

		Assert.AreEqual (an.CodeBase, clone.CodeBase, "CodeBase");
		Assert.AreEqual (an.CultureInfo, clone.CultureInfo, "CultureInfo");
		Assert.AreEqual (an.EscapedCodeBase, clone.EscapedCodeBase, "EscapedCodeBase");
		Assert.AreEqual (an.Flags, clone.Flags, "Flags");
		Assert.AreEqual (an.FullName, clone.FullName, "FullName");
		Assert.AreEqual (an.HashAlgorithm, clone.HashAlgorithm, "HashAlgorithm");
		Assert.AreEqual (an.KeyPair, clone.KeyPair, "KeyPair");
		Assert.AreEqual (an.Name, clone.Name, "Name");
		Assert.AreEqual (an.Version, clone.Version, "Version");
		Assert.AreEqual (an.VersionCompatibility, clone.VersionCompatibility, "VersionCompatibility");
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:16,代码来源:AssemblyNameTest.cs

示例15: Clone_Empty

	public void Clone_Empty ()
	{
		an = new AssemblyName ();
		AssemblyName clone = (AssemblyName) an.Clone ();

		Assert.IsNull (clone.CodeBase, "CodeBase");
		Assert.IsNull (clone.CultureInfo, "CultureInfo");
		Assert.IsNull (clone.EscapedCodeBase, "EscapedCodeBase");
		Assert.AreEqual (AssemblyNameFlags.None, clone.Flags, "Flags");
		Assert.IsNull (clone.FullName, "FullName");
		Assert.AreEqual (AssemblyHashAlgorithm.None, clone.HashAlgorithm, "HashAlgorithm");
		Assert.IsNull (clone.KeyPair, "KeyPair");
		Assert.IsNull (clone.Name, "Name");
		Assert.IsNull (clone.Version, "Version");
		Assert.AreEqual (AssemblyVersionCompatibility.SameMachine, 
			clone.VersionCompatibility, "VersionCompatibility");
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:17,代码来源:AssemblyNameTest.cs


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