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


C# Evidence.MergeWithNoDuplicates方法代码示例

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


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

示例1: CreateSecurityIdentity

 private static Evidence CreateSecurityIdentity(SafePEFileHandle peFile, Evidence hostProvidedEvidence)
 {
     PEFileEvidenceFactory target = new PEFileEvidenceFactory(peFile);
     Evidence evidence = new Evidence(target);
     if (hostProvidedEvidence != null)
     {
         evidence.MergeWithNoDuplicates(hostProvidedEvidence);
     }
     return evidence;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:PEFileEvidenceFactory.cs

示例2: CreateSecurityIdentity

        private static Evidence CreateSecurityIdentity(SafePEFileHandle peFile,
                                                       Evidence hostProvidedEvidence)
        {

            PEFileEvidenceFactory evidenceFactory = new PEFileEvidenceFactory(peFile);
            Evidence evidence = new Evidence(evidenceFactory);

            // If the host (caller of Assembly.Load) provided evidence, merge it with the evidence we've just
            // created. The host evidence takes priority.
            if (hostProvidedEvidence != null)
            {
                evidence.MergeWithNoDuplicates(hostProvidedEvidence);
            }

            return evidence;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:pefileevidencefactory.cs

示例3: CreateSecurityIdentity

        private Evidence CreateSecurityIdentity(String url,
                                                byte[] uniqueID,
                                                int zone,
                                                byte[] cert,
                                                byte[] serializedEvidence,
                                                Evidence additionalEvidence)
        {
            Evidence evidence = new Evidence();

            if (zone != -1)
                evidence.AddHost( new Zone((SecurityZone)zone) );
            if (url != null)
            {
                evidence.AddHost( new Url(url, true) );

                // Only create a site piece of evidence if we are not loading from a file.
                if (String.Compare( url, 0, s_localFilePrefix, 0, 5, true, CultureInfo.InvariantCulture) != 0)
                    evidence.AddHost( Site.CreateFromUrl( url ) );
            }


            // This code was moved to a different function because:
            // 1) it is rarely called so we should only JIT it if we need it.
            // 2) it references lots of classes that otherwise aren't loaded.
            if (serializedEvidence != null)
                DecodeSerializedEvidence( evidence, serializedEvidence );

            byte[] blob = nGetPublicKey();

            if ((blob != null) &&
                (blob.Length != 0))
                AddStrongName( evidence, blob );
            // If the host (caller of Assembly.Load) provided evidence, merge it
            // with the evidence we've just created. The host evidence takes
            // priority.
            if (additionalEvidence != null)
                evidence.MergeWithNoDuplicates(additionalEvidence);

            return evidence;
        }
开发者ID:ArildF,项目名称:masters,代码行数:40,代码来源:assembly.cs

示例4: MergeApplicationEvidence

        internal static Evidence MergeApplicationEvidence(Evidence evidence,
                                                          ApplicationIdentity applicationIdentity,
                                                          ActivationContext activationContext,
                                                          string[] activationData,
                                                          ApplicationTrust applicationTrust)
        {
            Evidence appEvidence = new Evidence();

            ActivationArguments activationArgs = (activationContext == null ? new ActivationArguments(applicationIdentity, activationData) : new ActivationArguments(activationContext, activationData));
            appEvidence = new Evidence();
            appEvidence.AddHostEvidence(activationArgs);

            if (applicationTrust != null)
                appEvidence.AddHostEvidence(applicationTrust);

            if (activationContext != null)
            {
                Evidence asiEvidence = new ApplicationSecurityInfo(activationContext).ApplicationEvidence;
                if (asiEvidence != null)
                    appEvidence.MergeWithNoDuplicates(asiEvidence);
            }

            if (evidence != null)
                appEvidence.MergeWithNoDuplicates(evidence);

            return appEvidence;
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:27,代码来源:cmsutils.cs

示例5: CreateSecurityIdentity

 private static System.Security.Policy.Evidence CreateSecurityIdentity(Assembly asm, string strUrl, int zone, byte[] cert, byte[] publicKeyBlob, string strSimpleName, int major, int minor, int build, int revision, byte[] serializedEvidence, System.Security.Policy.Evidence additionalEvidence)
 {
     System.Security.Policy.Evidence evidence = new System.Security.Policy.Evidence();
     if (zone != -1)
     {
         evidence.AddHost(new Zone((SecurityZone) zone));
     }
     if (strUrl != null)
     {
         evidence.AddHost(new Url(strUrl, true));
         if (string.Compare(strUrl, 0, "file:", 0, 5, StringComparison.OrdinalIgnoreCase) != 0)
         {
             evidence.AddHost(Site.CreateFromUrl(strUrl));
         }
     }
     if (cert != null)
     {
         AddX509Certificate(evidence, cert);
     }
     if ((asm != null) && RuntimeEnvironment.FromGlobalAccessCache(asm))
     {
         evidence.AddHost(new GacInstalled());
     }
     if (serializedEvidence != null)
     {
         DecodeSerializedEvidence(evidence, serializedEvidence);
     }
     if ((publicKeyBlob != null) && (publicKeyBlob.Length != 0))
     {
         AddStrongName(evidence, publicKeyBlob, strSimpleName, major, minor, build, revision, asm);
     }
     if ((asm != null) && !asm.nIsDynamic())
     {
         evidence.AddHost(new Hash(asm));
     }
     if (additionalEvidence != null)
     {
         evidence.MergeWithNoDuplicates(additionalEvidence);
     }
     if (asm != null)
     {
         HostSecurityManager hostSecurityManager = AppDomain.CurrentDomain.HostSecurityManager;
         if ((hostSecurityManager.Flags & HostSecurityManagerOptions.HostAssemblyEvidence) == HostSecurityManagerOptions.HostAssemblyEvidence)
         {
             return hostSecurityManager.ProvideAssemblyEvidence(asm, evidence);
         }
     }
     return evidence;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:49,代码来源:Assembly.cs

示例6: MergeApplicationEvidence

 internal static Evidence MergeApplicationEvidence(Evidence evidence, ApplicationIdentity applicationIdentity, ActivationContext activationContext, string[] activationData, ApplicationTrust applicationTrust)
 {
     Evidence evidence2 = new Evidence();
     ActivationArguments id = (activationContext == null) ? new ActivationArguments(applicationIdentity, activationData) : new ActivationArguments(activationContext, activationData);
     evidence2 = new Evidence();
     evidence2.AddHost(id);
     if (applicationTrust != null)
     {
         evidence2.AddHost(applicationTrust);
     }
     if (activationContext != null)
     {
         Evidence applicationEvidence = new ApplicationSecurityInfo(activationContext).ApplicationEvidence;
         if (applicationEvidence != null)
         {
             evidence2.MergeWithNoDuplicates(applicationEvidence);
         }
     }
     if (evidence != null)
     {
         evidence2.MergeWithNoDuplicates(evidence);
     }
     return evidence2;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:24,代码来源:CmsUtils.cs

示例7: CreateSecurityIdentity

        private static Evidence CreateSecurityIdentity(Assembly asm,
                                                String strUrl,
                                                int zone,
                                                byte[] cert,
                                                byte[] publicKeyBlob,
                                                String strSimpleName,
                                                int major,
                                                int minor,
                                                int build,
                                                int revision,
                                                byte[] serializedEvidence,
                                                Evidence additionalEvidence)
        {
            Evidence evidence = new Evidence();

            if (zone != -1)
                evidence.AddHost( new Zone((SecurityZone)zone) );
            if (strUrl != null)
            {
                evidence.AddHost( new Url(strUrl, true) );

                // Only create a site piece of evidence if we are not loading from a file.
                if (String.Compare( strUrl, 0, s_localFilePrefix, 0, 5, StringComparison.OrdinalIgnoreCase) != 0)
                    evidence.AddHost( Site.CreateFromUrl( strUrl ) );
            }


            // Determine if it's in the GAC and add some evidence about it
            if(asm != null && System.Runtime.InteropServices.RuntimeEnvironment.FromGlobalAccessCache(asm))
                evidence.AddHost( new GacInstalled() );

            // This code was moved to a different function because:
            // 1) it is rarely called so we should only JIT it if we need it.
            // 2) it references lots of classes that otherwise aren't loaded.
            if (serializedEvidence != null)
                DecodeSerializedEvidence( evidence, serializedEvidence );

            if ((publicKeyBlob != null) &&
                (publicKeyBlob.Length != 0))
                AddStrongName( evidence, publicKeyBlob, strSimpleName, major, minor, build, revision );


            // If the host (caller of Assembly.Load) provided evidence, merge it
            // with the evidence we've just created. The host evidence takes
            // priority.
            if (additionalEvidence != null)
                evidence.MergeWithNoDuplicates(additionalEvidence);

            if (asm != null) {
                // The host might want to modify the evidence of the assembly through
                // the HostSecurityManager provided in AppDomainManager, so take that into account.
                HostSecurityManager securityManager = AppDomain.CurrentDomain.HostSecurityManager;
                if ((securityManager.Flags & HostSecurityManagerOptions.HostAssemblyEvidence) == HostSecurityManagerOptions.HostAssemblyEvidence)
                    return securityManager.ProvideAssemblyEvidence(asm, evidence);
            }

            return evidence;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:58,代码来源:assembly.cs


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