private static CAEXDocument LoadFile(ref string AMLFile)
 {
     PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
     if (String.IsNullOrEmpty(AMLFile))
     {
         // Ask for File
         PrintHelper.printCentredLine("Which File do you want to validate?\n");
         AMLFile = PrintHelper.GetFile("AML-File", "*.AML");
     }
     // look up input is actual file
     if (String.IsNullOrEmpty(AMLFile))
     {
         return(null);
     }
     else
     {
         return(CAEXDocument.LoadFromFile(AMLFile));
     }
 }
Esempio n. 2
0
        private void print_Error(ValidationElement validationElement)
        {
            Console.WriteLine("\n\n");
            PrintHelper.println("Found Error\n\n", ConsoleColor.Red);

            if (!String.IsNullOrEmpty(validationElement.LongDescription))
            {
                PrintHelper.println($"{validationElement.LongDescription}\n", ConsoleColor.Yellow);
            }
            else
            {
                PrintHelper.println($"Exception: {validationElement.ValidationInformation}", this.default_foreground);
            }

            PrintHelper.println($"Error with attribute \"{validationElement.ValidatedAttribute}\" \n", this.default_foreground);

            PrintHelper.println($"Options for reparing \"{validationElement.AvailableRepairOptions}\" \n", ConsoleColor.Green);

            PrintHelper.println("Error in element: \n", this.default_foreground);
            PrintHelper.println($"{PrintHelper.line()} \n{validationElement.Element}\n{PrintHelper.line()} \n\n", ConsoleColor.Blue);
        }
        private static void EditOptions(ref Options CurrentOptions)
        {
            bool Continue         = true;
            bool ExceptionHappend = false;

            do
            {
                PrintHelper.printOptions(CurrentOptions.AutoRepair, CurrentOptions.PrintAllVal);
                string SelectedOption = Console.ReadLine().ToUpper();
                switch (SelectedOption)
                {
                case "":
                case "EXIT":
                case "QUIT":
                    Continue = false;
                    break;

                case "AUTOREPAIR":
                    PrintHelper.printOptionAutoRepair(CurrentOptions.AutoRepair);
                    try
                    {
                        CurrentOptions.AutoRepair = bool.Parse(Console.ReadLine());
                    }
                    catch (Exception)
                    {
                        Console.Clear();
                        PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                        PrintHelper.println("Invalid Value. Did not Change Config\n\n", ConsoleColor.Red);
                        ExceptionHappend = true;
                    }
                    if (!ExceptionHappend)
                    {
                        Console.Clear();
                        PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                    }
                    Console.WriteLine("Do you want to Edit another Value? (Yes/No)\n");
                    PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                    if (Console.ReadLine().ToUpper() == "NO")
                    {
                        Continue = false;
                    }
                    break;

                case "PRINTALLVAL":
                    PrintHelper.printOptionPrintAllVal(CurrentOptions.PrintAllVal);
                    try
                    {
                        CurrentOptions.PrintAllVal = bool.Parse(Console.ReadLine());
                    }
                    catch (Exception)
                    {
                        Console.Clear();
                        PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                        PrintHelper.println("Invalid Value. Did not Change Config\n\n", ConsoleColor.Red);
                        ExceptionHappend = true;
                    }
                    if (!ExceptionHappend)
                    {
                        Console.Clear();
                        PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                    }
                    Console.WriteLine("Do you want to Edit another Value? (Yes/No)\n");
                    PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                    if (Console.ReadLine().ToUpper() == "NO")
                    {
                        Continue = false;
                    }
                    break;

                default:
                    Console.Clear();
                    PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                    PrintHelper.printCentredLine("This Option does not Exist.\n\n");
                    PrintHelper.printCentredLine("Do you want to try again? (Yes/No)\n\n");
                    PrintHelper.printCentredLine(PrintHelper.line() + "\n\n");
                    if (Console.ReadLine().ToUpper() == "NO")
                    {
                        Continue = false;
                    }
                    break;
                }
            } while (Continue);
            Console.Clear();
            PrintHelper.Exit("Redirecting to Main Menu");
        }