當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。