コード例 #1
0
        static public List <Sputnik> CreateFirst_SateliteList(string[] Str)
        {
            var      sputnik = new List <Sputnik>();
            int      k       = 0;
            int      number  = 0;
            DateTime data    = new DateTime();
            string   infor   = "";

            for (int j = 0; j < Str.Length; j++)
            {
                //тут добавить расчет секунд.
                var newStr = Str[j].Split(' ');
                if (newStr.Length > 1)
                {
                    var nextStr = noSpace(newStr);
                    if (k < 1)
                    {
                        number = Convert.ToInt32(nextStr[0]);
                        data   = Get_Data(nextStr);
                        for (int i = 6; i < nextStr.Length; i++)
                        {
                            if (i != nextStr.Length - 1)
                            {
                                infor = infor + nextStr[i] + " ";
                            }
                            else
                            {
                                infor = infor + nextStr[i] + '\n';
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < nextStr.Length; i++)
                        {
                            if (i != nextStr.Length - 1)
                            {
                                infor = infor + nextStr[i] + " ";
                            }
                            else
                            {
                                infor = infor + nextStr[i] + '\n';
                            }
                        }
                    }
                    k++;
                    if (k == 8)
                    {
                        var sput = new Sputnik(number, data, infor);
                        sputnik.Add(sput);
                        infor  = "";
                        number = 0;
                        k      = 0;
                    }
                }
            }
            return(sputnik);
        }
コード例 #2
0
        private static List <Sputnik> GropBay_List(List <Sputnik> satelite, int i)
        {
            List <Sputnik> finish   = new List <Sputnik>();
            var            groupBya = satelite.GroupBy(item => item.data);
            var            spSat    = new Sputnik();

            foreach (var group in groupBya)
            {
                foreach (var item in group)
                {
                    switch (groupBya.Count())
                    {
                    case 1:
                        finish.Add(spSat.GetSputnik(item.number, item.data, item.ephemerisInfo, item.fullinfo));
                        break;

                    case 2:
                        if (i == 1)
                        {
                            finish.Add(spSat.GetSputnik(item.number, item.data, item.ephemerisInfo, item.fullinfo));
                        }
                        break;

                    case 3:
                        if (i == 2)
                        {
                            finish.Add(spSat.GetSputnik(item.number, item.data, item.ephemerisInfo, item.fullinfo));
                        }
                        break;

                    default:
                        Console.WriteLine("Разбиений нет");
                        break;
                    }
                }
                i++;
            }
            return(finish);
        }