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


C# Evidence.GetAssemblyEnumerator方法代码示例

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


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

示例1: EvidenceCallMethods

 public static void EvidenceCallMethods()
 {
     Evidence e = new Evidence();
     e = new Evidence(new Evidence());
     e.Clear();
     Evidence e2 = e.Clone();
     System.Collections.IEnumerator ie = e.GetAssemblyEnumerator();
     ie = e.GetHostEnumerator();
     e.Merge(e2);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:EvidenceTests.cs

示例2: DefaultConstructor

		public void DefaultConstructor ()
		{
			Evidence evidence = new Evidence ();
			
			AssertEquals ("Default constructor count should be zero", evidence.Count, 0);
			AssertEquals ("Default constructor host enumerator MoveNext() should be false", 
				evidence.GetHostEnumerator().MoveNext(), false);
			AssertEquals ("Default constructor assembly enumerator MoveNext() should be false",
				evidence.GetAssemblyEnumerator().MoveNext(), false);
			AssertEquals ("Default constructor enumerator MoveNext() should be false",
				evidence.GetEnumerator().MoveNext(), false);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:12,代码来源:EvidenceTest.cs

示例3: GetFactorySuppliedEvidence

 public IEnumerable<EvidenceBase> GetFactorySuppliedEvidence()
 {
     if (this.m_assemblyProvidedEvidence == null)
     {
         byte[] o = null;
         GetAssemblySuppliedEvidence(this.m_peFile, JitHelpers.GetObjectHandleOnStack<byte[]>(ref o));
         this.m_assemblyProvidedEvidence = new List<EvidenceBase>();
         if (o != null)
         {
             Evidence evidence = new Evidence();
             new SecurityPermission(SecurityPermissionFlag.SerializationFormatter).Assert();
             try
             {
                 BinaryFormatter formatter = new BinaryFormatter();
                 using (MemoryStream stream = new MemoryStream(o))
                 {
                     evidence = (Evidence) formatter.Deserialize(stream);
                 }
             }
             catch
             {
             }
             CodeAccessPermission.RevertAssert();
             if (evidence != null)
             {
                 IEnumerator assemblyEnumerator = evidence.GetAssemblyEnumerator();
                 while (assemblyEnumerator.MoveNext())
                 {
                     if (assemblyEnumerator.Current != null)
                     {
                         EvidenceBase current = assemblyEnumerator.Current as EvidenceBase;
                         if (current == null)
                         {
                             current = new LegacyEvidenceWrapper(assemblyEnumerator.Current);
                         }
                         this.m_assemblyProvidedEvidence.Add(current);
                     }
                 }
             }
         }
     }
     return this.m_assemblyProvidedEvidence;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:43,代码来源:PEFileEvidenceFactory.cs

示例4: GetFactorySuppliedEvidence

        public IEnumerable<EvidenceBase> GetFactorySuppliedEvidence()
        {
            if (m_assemblyProvidedEvidence == null)
            {
                byte[] serializedEvidence = null;
                GetAssemblySuppliedEvidence(m_peFile, JitHelpers.GetObjectHandleOnStack(ref serializedEvidence));

                m_assemblyProvidedEvidence = new List<EvidenceBase>();
                if (serializedEvidence != null)
                {
                    Evidence deserializedEvidence = new Evidence();

                    // Partial trust assemblies can provide their own evidence, so make sure that we have
                    // permission to deserialize it
                    new SecurityPermission(SecurityPermissionFlag.SerializationFormatter).Assert();

                    try
                    {
                        BinaryFormatter formatter = new BinaryFormatter();
                        using (MemoryStream ms = new MemoryStream(serializedEvidence))
                        {
                            deserializedEvidence = (Evidence)formatter.Deserialize(ms);
                        }
                    }
                    catch { /* Ignore any errors deserializing */ }

                    CodeAccessPermission.RevertAssert();

                    // Enumerate the assembly evidence, ignoring any host evidence supplied.  Since we
                    // could be loading a Whidbey assembly, we need to use the old GetAssemblyEnumerator
                    // API and deal with objects instead of EvidenceBases.
                    if (deserializedEvidence != null)
                    {
                        IEnumerator enumerator = deserializedEvidence.GetAssemblyEnumerator();

                        while (enumerator.MoveNext())
                        {
                            if (enumerator.Current != null)
                            {
                                // If this is a legacy evidence object, we need to wrap it before
                                // returning it.
                                EvidenceBase currentEvidence = enumerator.Current as EvidenceBase;
                                if (currentEvidence == null)
                                {
                                    currentEvidence = new LegacyEvidenceWrapper(enumerator.Current);
                                }

                                m_assemblyProvidedEvidence.Add(currentEvidence);
                            }
                        }
                    }
                }
            }

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

示例5: GetHostAssemblyEnumerator

		public void GetHostAssemblyEnumerator ()
		{
			object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
			object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
			Evidence evidence;
			IEnumerator enumerator;
			int i;

			evidence = new Evidence (hostarray, asmbarray);
			enumerator = evidence.GetAssemblyEnumerator ();
			
			i = 0;
			while (enumerator.MoveNext()) {
        	        	Assert.AreEqual (enumerator.Current, asmbarray[i++]);
			}
		}
开发者ID:narutopatel,项目名称:mono,代码行数:16,代码来源:EvidenceTest.cs

示例6: MakeResourceAssemblyEvidence

        internal static void MakeResourceAssemblyEvidence( Evidence input, out Evidence output, out StrongName outputSn )
        {
            IEnumerator eviEnumerator = input.GetHostEnumerator();

            output = new Evidence();
            outputSn = null;

            while (eviEnumerator.MoveNext())
            {
                if (eviEnumerator.Current is StrongName)
                {
                    StrongName inputSn = (StrongName)eviEnumerator.Current;

                    outputSn = new StrongName( inputSn.PublicKey, inputSn.Name + ".resource", inputSn.Version );

                    output.AddHost( outputSn );
                }
                else
                {
                    output.AddHost( eviEnumerator.Current );
                }
            }

            eviEnumerator = input.GetAssemblyEnumerator();

            while (eviEnumerator.MoveNext())
            {
                output.AddAssembly( eviEnumerator.Current );
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:30,代码来源:caspol.cs


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