示例#1
0
文件: Form1.cs 项目: Migmigr/P-test
        double[] FromFile2(string p, bool sc)
        {
            List <double> d        = new List <double>();
            StreamReader  myStream = null;
            List <string> st       = new List <string>();

            if ((myStream = new StreamReader(Application.StartupPath + "\\ВЫБОРКИ\\" + p)) != null)
            {
                using (myStream)
                {
                    string line;
                    while ((line = myStream.ReadLine()) != null)
                    {
                        string[] chasti = line.Split(' ');
                        if (Convert.ToDouble(chasti[1]) != 0)
                        {
                            d.Add(Convert.ToDouble(chasti[1]));
                            st.Add(line);
                        }
                    }
                }
            }

            double[]  da          = d.ToArray();
            IComparer revComparer = new ReverseComparerP();

            Array.Sort(da, revComparer);
            return(da);
        }
示例#2
0
文件: Form1.cs 项目: Migmigr/P-test
        double[] FromFile(string p)
        {
            double[]     d        = new double[0];;
            StreamReader myStream = null;

            if ((myStream = new StreamReader(p)) != null)
            {
                using (myStream)
                {
                    string line;
                    line = myStream.ReadLine();
                    string[] Numbers = line.Split(' ');
                    d = new double[Numbers.Length];
                    for (int i = 0; i < d.Length; i++)
                    {
                        d[i] = Convert.ToDouble(Numbers[i]);
                    }
                }
            }
            IComparer revComparer = new ReverseComparerP();

            Array.Sort(d, revComparer);
            return(d);
        }