Exemple #1
0
        static void Main(string[] args)
        {
            if (!args.Count().Equals(5))
            {
                Console.WriteLine("Invalid number of arguments!");
            }
            else
            {
                int    seed                 = Int32.Parse(args[0]);
                string diversFilePath       = args[1];
                string diveScheduleFilePath = args[2];
                string algorithmName        = args[3];
                string outFilePath          = args[4];

                if (seed >= 100)
                {
                    DiverApplication APP = new DiverApplication(seed, diversFilePath, diveScheduleFilePath, algorithmName, outFilePath);
                    APP.Init();
                }
                else
                {
                    Console.WriteLine("Warning: seed needs to be greater than 99!");
                }
            }

            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            bool   validArguments = true;
            string errMsg         = "";

            if (!args.Count().Equals(7))
            {
                Console.WriteLine("Neispravan broj argumenata!");
            }
            else
            {
                int seed = 0;

                // File paths
                string diversFilePath       = args[1];
                string diveScheduleFilePath = args[2];
                string outFilePath          = args[6];

                // Algorithm names
                string[] algorithms = new string[] {
                    args[3],
                    args[4],
                    args[5]
                };

                // Seed validation
                if (!Validation.ValidateSeedNumber(args[0]))
                {
                    validArguments = false;
                    errMsg         = Validation.seedErr;
                }
                else
                {
                    seed = Int32.Parse(args[0]);
                }

                // File path validation
                if (!Validation.ValidateFilePath(diversFilePath) || !Validation.ValidateFilePath(diveScheduleFilePath) || !Validation.ValidateFilePath(outFilePath))
                {
                    validArguments = false;
                    errMsg         = Validation.filePathErr;
                }

                // Algorithm name validation
                List <string> acceptedAlgorithms = Validation.ValidateAlgorithmNames(algorithms);
                if (acceptedAlgorithms.Count() == 0)
                {
                    validArguments = false;
                    errMsg         = Validation.algorithmErr;
                }

                if (validArguments)
                {
                    DiverApplication APP = new DiverApplication(seed, diversFilePath, diveScheduleFilePath, acceptedAlgorithms, outFilePath);
                    APP.Init();
                }
                else
                {
                    Console.WriteLine(errMsg);
                }
            }

            Console.ReadLine();
        }