Exemple #1
0
    public static void StartProgram()
    {
        // Setup console application
        Console.Title = titleOfApplication;

        // Set currunt section
        currentSection = ChoosingState.ChoosingComparisons;

        // Print first menu section
        PrintSection();
    }
Exemple #2
0
    public static void AddDataFromInput(int input, bool printAfter = true)
    {
        // Adds the data by the user's input
        // Prints the next section
        // Or starts the benchmark if it is the last section

        if (IsNumberValid(input))
        {
            int inputForArray = input - 1;
            switch (currentSection)
            {
            case ChoosingState.ChoosingComparisons:
                currentBenchmarkData = new BenchmarkData(BenchmarksManager.comparisons[inputForArray]);
                currentSection       = ChoosingState.ChoosingDuration;
                if (printAfter)
                {
                    PrintSection();
                }
                break;

            case ChoosingState.ChoosingDuration:
                currentBenchmarkPresetGroup = BenchmarksManager.benchmarkPresetGroups[inputForArray];
                currentSection = ChoosingState.ChoosingPreset;
                if (printAfter)
                {
                    PrintSection();
                }
                break;

            case ChoosingState.ChoosingPreset:
                currentSection = ChoosingState.Complete;
                currentBenchmarkData.InputPreset(currentBenchmarkPresetGroup.presets[inputForArray], currentBenchmarkPresetGroup.Name, input);
                BenchmarksManager.RunBenchmark(currentBenchmarkData);
                break;

            default:
                break;
            }
        }

        else
        {
            ActiveError("Number is invalid. Number: <" + input + ">");
        }
    }