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


C# EvaluationEngine.WriteDocument方法代码示例

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


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

示例1: Main

		/// <summary>
		/// Main method for the tool it receives command line arguments and performs the evaluation.
		/// </summary>
		/// <param name="args">The parsed command line arguments.</param>
		static void Main(string[] args)
		{
		    var t = ConfigurationManager.OpenExeConfiguration(@"C:\Git\Xacml.Net\Xacml.Console\bin\Debug\Xacml.Console.exe.config");

            string policy = String.Empty, request = String.Empty;
			bool verbose = false;
            //foreach (string arg in args)
            //{
            //    if ((arg[0] == '/' || arg[0] == '-'))
            //    {
            //        if (arg[1] == 'p' || arg[1] == 'P')
            //        {
            //            policy = arg.Substring(3);
            //        }

            //        if (arg[1] == 'r' || arg[1] == 'R')
            //        {
            //            request = arg.Substring(3);
            //        }

            //        if (arg[1] == 'v' || arg[1] == 'V')
            //        {
            //            verbose = true;
            //        }
            //    }
            //}

            try
			{
                request = @"C:\Git\Xacml.Net\Samples\requests\IIA001Request.xml";
                //request = @"C:\Git\Xacml.Net\Samples\Request.xml";
                policy = @"C:\Git\Xacml.Net\Samples\Policy.xml";
                if ( request.Length != 0 && policy.Length != 0 )
				{
				    using (FileStream fs1 = new FileStream(request, FileMode.Open, FileAccess.Read))

				    {
				        // Load Request
				        ContextDocumentReadWrite requestDocument = ContextLoader.LoadContextDocument(fs1, XacmlVersion.Version20);
                        
                        var res = new EvaluationEngine(verbose).Evaluate((ContextDocument)requestDocument);
                        XmlTextWriter tw = new XmlTextWriter(System.Console.Out) { Formatting = Formatting.Indented };
                        res.WriteDocument(tw);
                    }

                    
				}
				else
				{
					throw new Exception( "Request or policy file not specified." );
				}
			}
			catch( Exception e )
			{
				System.Console.WriteLine( e.Message );
				System.Console.WriteLine();
				System.Console.WriteLine( "Usage:" );
				System.Console.WriteLine( "\t-p:[policyFilePath]  - The path to the policy file" );
				System.Console.WriteLine( "\t-r:[requestFilePath] - The path to the request file" );
				System.Console.WriteLine( "\t-v                   - Makes the execution verbose" );
			}

            System.Console.WriteLine("Press Enter to close...");
		    System.Console.ReadLine();
		}
开发者ID:Condeti,项目名称:XACML.NET,代码行数:69,代码来源:MainClass.cs


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