Пример #1
0
        private void button11_Click(object sender, EventArgs e)
        {
            act.Value = true;
            listBox4.Items.Clear();

            StreamReader sr = new StreamReader("Temp\\Pow.txt");
            string date = sr.ReadLine();
            int oldPow = Convert.ToInt32(sr.ReadLine());
            List<int> PowInds = new List<int>();
            while (sr.EndOfStream != true)
                PowInds.Add(Convert.ToInt32(sr.ReadLine()));
            sr.Close();

            sr = new StreamReader("Temp\\Inv.txt");
            int oldInv = Convert.ToInt32(sr.ReadLine());
            List<int> InvInds = new List<int>();
            while (sr.EndOfStream != true)
                InvInds.Add(Convert.ToInt32(sr.ReadLine()));
            sr.Close();

            sr = new StreamReader("Temp\\W.txt");
            int iW = Convert.ToInt32(sr.ReadLine());
            List<int> W = new List<int>();
            while (sr.EndOfStream != true)
                W.Add(Convert.ToInt32(sr.ReadLine()));
            sr.Close();

            sr = new StreamReader("Temp\\A.txt");
            int iA = Convert.ToInt32(sr.ReadLine());
            List<int> A = new List<int>();
            while (sr.EndOfStream != true)
                A.Add(Convert.ToInt32(sr.ReadLine()));
            sr.Close();

            sr = new StreamReader("Temp\\B.txt");
            int iB = Convert.ToInt32(sr.ReadLine());
            List<int> B = new List<int>();
            while (sr.EndOfStream != true)
                B.Add(Convert.ToInt32(sr.ReadLine()));
            sr.Close();

            sr = new StreamReader("Temp\\N.txt");
            int iN = Convert.ToInt32(sr.ReadLine());
            List<BigInteger> N = new List<BigInteger>();
            while (sr.EndOfStream != true)
                N.Add(BigInteger.Parse(sr.ReadLine()));
            sr.Close();

            sr = new StreamReader("Temp\\Pols.txt");
            int mod = Convert.ToInt32(sr.ReadLine());
            List<cpolinom> pols = new List<cpolinom>();
            while (sr.EndOfStream != true)
                pols.Add(new cpolinom(sr.ReadLine(), mod));
            sr.Close();

            args a = new args(pols, PowInds, InvInds, W, A, B, N, oldPow, oldInv, iW, iA, iB, iN, date);

            Thread th = new Thread(Pows);
            th.Start(a);
        }
Пример #2
0
        private void button7_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                act.Value = true;                
                string s = openFileDialog1.FileName;
                int p = FindP(CorrectName(s));
                List<BigInteger> N = ReadString2(textBox7.Text);
                List<int> W = ReadString(textBox10.Text);
                List<int> A = ReadString(textBox11.Text);
                List<int> B = ReadString(textBox12.Text);
                List<cpolinom> pols = new List<cpolinom>();

                StreamReader sr = new StreamReader(s);
                string str = sr.ReadLine();
                str = str.Substring(1, str.Length - 2);
                pols.Add(new cpolinom(str, p));
                sr.ReadLine();

                while (sr.EndOfStream == false)                
                    pols.Add(new cpolinom(sr.ReadLine(), p));
                sr.Close();

                string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + " " + DateTime.Now.Hour + "-" + DateTime.Now.Minute;
                Directory.CreateDirectory(date);

                List<int> ci1 = new List<int>();
                if(checkBox9.Checked == true)
                    for (int i = 0; i < checkedListBox1.CheckedIndices.Count; i++)
                        ci1.Add(checkedListBox1.CheckedIndices[i]);
                if(checkBox10.Checked == true)
                    for (int i = 0; i < checkedListBox1.CheckedIndices.Count; i++)
                        ci1.Add(checkedListBox1.CheckedIndices[i] + checkedListBox1.Items.Count);

                List<int> ci2 = new List<int>();
                for (int i = 0; i < checkedListBox2.CheckedIndices.Count; i++)
                    ci2.Add(checkedListBox2.CheckedIndices[i]);

                args a = new args(pols, ci1, ci2, W, A, B, N, 0, 0, 0, 0, 0, 0, date);                

                listBox4.Items.Clear();

                Thread th = new Thread(Pows);
                th.Start(a);    
            }
        }