Beispiel #1
0
 public void MiddleTrig4(int i)
 {
     try
     {
         string text  = "";
         string task  = "";
         string task1 = "";
         string task2 = "";
         task1 = $"(sin (x)) = 0";
         task2 = $"(cos (x)) = {TrigArgument()}";
         task  = TrigCosCube(task1, task2);
         task  = AddCastFormulas(task);
         if (AnswersCheckBox.Checked == true)
         {
             text += $"{i + 1}) {task}\n{TrigAns(task1)}\n{TrigAns(task2)}\n{task1}\n{task2}\n\n";
         }
         else
         {
             text += $"{i + 1}) {task}\n\n";
         }
         EndGameRB.AppendText($"{i + 1}) " + task + "\n");
         File.AppendAllText(path, text);
     }
     catch (System.IO.FileNotFoundException ex)
     {
         MessageBox.Show("Были удалены исходные файлы, переустановите программу!");
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         Close();
     }
 }
Beispiel #2
0
        public void SimpleTrig(int i)
        {
            string text  = "";
            string task  = "";
            string task1 = "";

            task1 = $"{TrigForm()} = {TrigArgument()}";
            task  = AddCastFormulas(task1);
            if (AnswersCheckBox.Checked == true)
            {
                text += $"{i + 1}) {task}\n{TrigAns(task1)}\n\n";
            }
            else
            {
                text += $"{i + 1}) {task}\n\n";
            }
            EndGameRB.AppendText($"{i + 1}) " + task + "\n");
            File.AppendAllText(path, text);
        }
Beispiel #3
0
        public void MiddleTrig2(int i)
        {
            string text  = "";
            string task  = "";
            string task1 = "";
            string task2 = "";

            task1 = $"(cos (x)) = {TrigArgument()}";
            task2 = $"(sin (x)) = {TrigArgument()}";
            task  = TrigCosSin(task1, task2, "cos");
            task  = AddCastFormulas(task);
            if (AnswersCheckBox.Checked == true)
            {
                text += $"{i + 1}) {task}\n{TrigAns(task1)}\n{TrigAns(task2)}\n{task1}\n{task2}\n\n";
            }
            else
            {
                text += $"{i + 1}) {task}\n\n";
            }
            EndGameRB.AppendText($"{i + 1}) " + task + "\n");
            File.AppendAllText(path, text);
        }
Beispiel #4
0
        private void GenBtn_Click(object sender, EventArgs e)
        {
            try
            {
                tick = 0;
                h    = 0;
                m    = 0;

                Timer.Enabled = true;

                int CountOT = 1;

                if (!int.TryParse(CBCount.Text, out CountOT))
                {
                    CountOT = 1;
                }


                EndGameRB.Clear();

                Key         key  = new Key();
                ConvertRule Rule = new ConvertRule(SimpleTrig);

                int intKeyGen = -1;

                if (int.TryParse(KeyGenTB.Text, out intKeyGen) && intKeyGen != -1)
                {
                    File.WriteAllText(path, "");
                    int   KGLength = intKeyGen.ToString().Length;
                    int[] mas      = new int[KGLength];
                    for (int i = 0; i < KGLength; i++)
                    {
                        mas[i]    = (intKeyGen % 10 % 6);
                        intKeyGen = intKeyGen / 10;
                    }
                    for (int i = 0; i < KGLength; i++)
                    {
                        switch (mas[i])
                        {
                        case 0:
                            Rule = SimpleTrig;
                            key.KeyGen(i, Rule);
                            break;

                        case 1:
                            Rule = MiddleTrig1;
                            key.KeyGen(i, Rule);
                            break;

                        case 2:
                            Rule = MiddleTrig2;
                            key.KeyGen(i, Rule);
                            break;

                        case 3:
                            Rule = MiddleTrig3;
                            key.KeyGen(i, Rule);
                            break;

                        case 4:
                            Rule = MiddleTrig4;
                            key.KeyGen(i, Rule);
                            break;

                        case 5:
                            Rule = MiddleTrig5;
                            key.KeyGen(i, Rule);
                            break;
                        }
                    }
                    ToHtml();
                    if (WebCheckBox.Checked == true)
                    {
                        Process.Start("ST.html");
                    }
                }
                else
                {
                    File.WriteAllText(path, "");
                    for (int i = 0; i < CountOT; i++)
                    {
                        int another = rnd.Next(1, 7);
                        if (another == 1)
                        {
                            SimpleTrig(i);
                        }
                        if (another == 2)
                        {
                            MiddleTrig1(i);
                        }
                        if (another == 3)
                        {
                            MiddleTrig2(i);
                        }
                        if (another == 4)
                        {
                            MiddleTrig3(i);
                        }
                        if (another == 5)
                        {
                            MiddleTrig4(i);
                        }
                        if (another == 6)
                        {
                            MiddleTrig5(i);
                        }
                    }
                    ToHtml();
                    if (WebCheckBox.Checked == true)
                    {
                        Process.Start("ST.html");
                    }
                }
            }
            catch (IOException ioex)
            {
                MessageBox.Show("Something wrong with files!\n" + ioex.ToString());
            }
            catch (UnauthorizedAccessException unex)
            {
                MessageBox.Show(unex.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }