/// <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(); }