public static void PrintBenchmarkToFile(BenchmarkInstance instance, string destination)
 {
     try
     {
         File.WriteAllText(destination, instance.ToString());
     }
     catch (ArgumentNullException anex)
     {
         MessageBox.Show(anex.Message);
     }
     catch (ArgumentException aex)
     {
         MessageBox.Show(aex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #2
0
        private void GenerateAndAddBencharkInstanceToList(GenerationArgs gArgs)
        {
            BenchmarkInstance benchmark = null;

            try
            {
                benchmark = BPMGeneratorMethods.GenerateOneBencharkInstance(gArgs);
            }
            catch (ArgumentOutOfRangeException rex)
            {
                MessageBox.Show(rex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (benchmark != null)
            {
                allGeneratedBenchmarks.Add(benchmark);
            }
        }
        public static BenchmarkInstance GenerateOneBencharkInstance(IGenerationArgs igenArgs)
        {
            List <JobParameters> jp = new List <JobParameters>();

            try
            {
                for (int i = 0; i < igenArgs.NumberOfJobs; i++)
                {
                    jp.Add(GenerateJobParameters(i, igenArgs));
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                throw new ArgumentOutOfRangeException("Job processing or job size values are not in order. Check Customize tab.");
            }

            string instanceName = "J" + igenArgs.NumberOfJobs.ToString() +
                                  "p" + igenArgs.JobProcessingTimeFrom + igenArgs.JobProcessingTimeTo +
                                  "s" + igenArgs.JobSizeFrom + igenArgs.JobSizeTo;

            BenchmarkInstance instance = new BenchmarkInstance(igenArgs.NumberOfJobs, igenArgs.MachineCapacity, instanceName, jp);

            return(instance);
        }