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


C# ApplicationTrust.FromXml方法代码示例

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


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

示例1: ApplicationTrustCallMethods

 public static void ApplicationTrustCallMethods()
 {
     ApplicationTrust at = new ApplicationTrust();
     SecurityElement se = new SecurityElement("");
     at.FromXml(se);
     se = at.ToXml();
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:EvidenceBaseTests.cs

示例2: FromXml_NoChild

		public void FromXml_NoChild ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			SecurityElement se = at.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("version", "1");

			at.FromXml (w);

			Assert.IsNull (at.ApplicationIdentity, "ApplicationIdentity");
			Assert.AreEqual (PolicyStatementAttribute.Nothing, at.DefaultGrantSet.Attributes, "DefaultGrantSet.Attributes");
			Assert.AreEqual (String.Empty, at.DefaultGrantSet.AttributeString, "DefaultGrantSet.AttributeString");
			Assert.IsTrue (at.DefaultGrantSet.PermissionSet.IsEmpty (), "DefaultGrantSet.PermissionSet.IsEmpty");
			Assert.IsFalse (at.DefaultGrantSet.PermissionSet.IsUnrestricted (), "DefaultGrantSet.PermissionSet.IsUnrestricted");
			Assert.IsNull (at.ExtraInfo, "ExtraInfo");
			Assert.IsFalse (at.IsApplicationTrustedToRun, "IsApplicationTrustedToRun");
			Assert.IsFalse (at.Persist, "Persist");
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:19,代码来源:ApplicationTrustTest.cs

示例3: FromXml_NoVersion

		public void FromXml_NoVersion ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			SecurityElement se = at.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			foreach (SecurityElement child in se.Children)
				w.AddChild (child);

			at.FromXml (w);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:ApplicationTrustTest.cs

示例4: FromXml_InvalidVersion

		public void FromXml_InvalidVersion ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			SecurityElement se = at.ToXml ();

			SecurityElement w = new SecurityElement (se.Tag);
			w.AddAttribute ("version", "2");
			foreach (SecurityElement child in se.Children)
				w.AddChild (child);

			at.FromXml (w);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:12,代码来源:ApplicationTrustTest.cs

示例5: FromXml_InvalidTag

		public void FromXml_InvalidTag ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			SecurityElement se = at.ToXml ();
			se.Tag = "MonoTrust";
			at.FromXml (se);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:ApplicationTrustTest.cs

示例6: FromXml_Null

		public void FromXml_Null ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			at.FromXml (null);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:5,代码来源:ApplicationTrustTest.cs

示例7: ToFromXmlRoundtrip

		public void ToFromXmlRoundtrip ()
		{
			ApplicationTrust at = new ApplicationTrust ();
			at.ApplicationIdentity = new ApplicationIdentity ("Mono Unit Test");
			at.DefaultGrantSet = new PolicyStatement (new PermissionSet (PermissionState.Unrestricted));
			at.ExtraInfo = "Mono";
			at.IsApplicationTrustedToRun = true;
			at.Persist = true;

			SecurityElement se = at.ToXml ();
			string expected = AdjustLineEnds ("<ApplicationTrust version=\"1\"\r\nFullName=\"Mono Unit Test, Culture=neutral\"\r\nTrustedToRun=\"true\"\r\nPersist=\"true\">\r\n<DefaultGrant>\r\n<PolicyStatement version=\"1\">\r\n<PermissionSet class=\"System.Security.PermissionSet\"\r\nversion=\"1\"\r\nUnrestricted=\"true\"/>\r\n</PolicyStatement>\r\n</DefaultGrant>\r\n<ExtraInfo Data=\"0001000000FFFFFFFF01000000000000000601000000044D6F6E6F0B\"/>\r\n</ApplicationTrust>\r\n");
			Assert.AreEqual (expected, AdjustLineEnds (at.ToXml ().ToString ()), "XML");

			ApplicationTrust copy = new ApplicationTrust ();
			copy.FromXml (se);
			se = copy.ToXml ();
			Assert.AreEqual (expected, AdjustLineEnds (at.ToXml ().ToString ()), "Copy");
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:18,代码来源:ApplicationTrustTest.cs

示例8: InternalGetApplicationTrust

 internal System.Security.Policy.ApplicationTrust InternalGetApplicationTrust()
 {
     if (this._ApplicationTrust == null)
     {
         return null;
     }
     SecurityElement element = SecurityElement.FromString(this._ApplicationTrust);
     System.Security.Policy.ApplicationTrust trust = new System.Security.Policy.ApplicationTrust();
     trust.FromXml(element);
     return trust;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:AppDomainSetup.cs

示例9: InternalGetApplicationTrust

		internal ApplicationTrust InternalGetApplicationTrust()
		{
			if (this._ApplicationTrust == null)
			{
				return null;
			}
			SecurityElement element = SecurityElement.FromString(this._ApplicationTrust);
			ApplicationTrust applicationTrust = new ApplicationTrust();
			applicationTrust.FromXml(element);
			return applicationTrust;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:11,代码来源:AppDomainSetup.cs

示例10: InternalGetApplicationTrust

        internal ApplicationTrust InternalGetApplicationTrust()
        {
            
            if (_ApplicationTrust == null) return null;


#if FEATURE_CORECLR            
            ApplicationTrust grantSet = new ApplicationTrust(NamedPermissionSet.GetBuiltInSet(_ApplicationTrust));
#else
            SecurityElement securityElement = SecurityElement.FromString(_ApplicationTrust);
            ApplicationTrust grantSet = new ApplicationTrust();
            grantSet.FromXml(securityElement);
#endif
            return grantSet;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:AppDomainSetup.cs


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