상속: MonoBehaviour
 public void TestCountSimiliarVsEmpty()
 {
     Assert.AreEqual(Ex1.CountSimilar(Ex4), 0);
     Assert.AreEqual(Ex2.CountSimilar(Ex4), 0);
     Assert.AreEqual(Ex3.CountSimilar(Ex4), 0);
     Assert.AreEqual(Ex4.CountSimilar(Ex4), 0);
 }
예제 #2
0
        private static void Solution4()
        {
            Ex4 ex4 = new Ex4();

            ex4.Solve();
        }
예제 #3
0
파일: Form1.cs 프로젝트: kollare/Arconic
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (goodInput && !loading)
            {
                loading = true;
                toolStripButton1.Enabled = false;

                if (iterations >= 100000)
                {
                    DialogResult option = MessageBox.Show("Running " + iterations + " simulations will " +
                                                          "take approximately: " + getTime() + "\nDo you wish to continue?", "Alert", MessageBoxButtons.OKCancel);

                    if (option == DialogResult.Cancel)
                    {
                        goto Done;
                    }
                }

                try
                {
                    if (pictureBox1.Image != null)
                    {
                        pictureBox1.Image.Dispose();
                    }
                }
                catch (Exception Ex0)
                {
                    var nullErrorMessageBox = MessageBox.Show
                                                  ("ERROR disposing old image file! \nOutput: "
                                                  + Ex0.ToString(), "Alert", MessageBoxButtons.OK);
                }

                RscriptWriter();

                userInputScript = rPathDest;
                Console.WriteLine("userInputScript: " + userInputScript);

                outputLocation = RpathFinder();
                Console.WriteLine("outputLocation: " + outputLocation);

                try
                {
                    RunFromCmd(userInputScript, userInputCSV, outputLocation, iterations.ToString(), distributionType);
                }
                catch (Exception Ex1)
                {
                    var nullErrorMessageBox = MessageBox.Show
                                                  ("ERROR on CMD process! \nOutput: "
                                                  + Ex1.ToString(), "Alert", MessageBoxButtons.OK);
                }

                try
                {
                    Cursor.Current             = Cursors.WaitCursor;
                    toolStripButton1.BackColor = Color.GreenYellow;

                    if (iterations >= 10000000)
                    {
                        Thread.Sleep(Convert.ToInt32(iterations * 0.10));
                    }
                    else if (iterations >= 100000 && iterations < 10000000)
                    {
                        Thread.Sleep(Convert.ToInt32(iterations * 0.30));
                    }
                    else if (iterations >= 10000 && iterations < 100000)
                    {
                        Thread.Sleep(Convert.ToInt32(iterations * 0.50));
                    }
                    else
                    {
                        Thread.Sleep(2500);
                    }
                }
                catch (Exception Ex2)
                {
                    var nullErrorMessageBox = MessageBox.Show
                                                  ("ERROR waiting for process to complete! \nOuput: "
                                                  + Ex2.ToString(), "Alert", MessageBoxButtons.OK);
                }

                try
                {
                    pictureBox1.Image = Image.FromFile(RpathFinder() + @"\output.png");
                }
                catch (Exception Ex3)
                {
                    var nullErrorMessageBox = MessageBox.Show
                                                  ("ERROR loading the image file! \nOuput: "
                                                  + Ex3.ToString(), "Alert", MessageBoxButtons.OK);
                }

Done:
                try
                {
                    if (!string.IsNullOrWhiteSpace(userInputScript))
                    {
                        DeleteTempFile(userInputScript);
                    }

                    //if (!string.IsNullOrWhiteSpace(userInputScript))
                    //DeleteTempFile(RpathFinder() + @"\output.png");

                    loading    = false;
                    maxWarning = false;
                    minWarning = false;
                }
                catch (Exception Ex4)
                {
                    var nullErrorMessageBox = MessageBox.Show
                                                  ("ERROR on cleanup process! \nOutput: "
                                                  + Ex4.ToString(), "Alert", MessageBoxButtons.OK);
                }
            }
        }