//nuskaito pradinius duomenis ---------------------------------------------
        private static void ReadData(string file, ZaidimoRatas[] zaidimai)
        {
            string ratas = null;
            string data  = null;

            using (StreamReader reader = new StreamReader(@file))
            {
                string line = null;

                if ((line = reader.ReadLine()) != null)
                {
                    ratas = line;
                }

                if ((line = reader.ReadLine()) != null)
                {
                    data = line;
                }
                ZaidimoRatas zaidimoratas = GetZaidimoRata(zaidimai, ratas);
                while (null != (line = reader.ReadLine()))
                {
                    string[] values   = line.Split(',');
                    string   vardas   = values[0];
                    string   pavarde  = values[1];
                    string   komanda  = values[2];
                    string   pozicija = values[3];
                    string   cemp     = values[4];
                    int      sunaik   = int.Parse(values[5]);
                    int      zuvo     = int.Parse(values[6]);
                    int      dalyvav  = int.Parse(values[7]);
                    Turnyras turnyras = new Turnyras(vardas, pavarde, komanda, pozicija, cemp, sunaik, zuvo, dalyvav);

                    if (!zaidimoratas.Zaidejai.Contains(turnyras))
                    {
                        zaidimoratas.AddTurnyras(turnyras);
                    }
                }
            }
        }
        static void Main(string[] args)
        {
            ZaidimoRatas[] zaidimai = new ZaidimoRatas[3];

            zaidimai[0] = new ZaidimoRatas("1");
            zaidimai[1] = new ZaidimoRatas("2");
            zaidimai[2] = new ZaidimoRatas("3");

            string[] filePaths = Directory.GetFiles(Directory.GetCurrentDirectory(), "*new.txt");//nuskaito visus failus, siusdamas po viena i ReadData metoda

            foreach (string path in filePaths)
            {
                ReadData(path, zaidimai);
            }

            using (StreamWriter writer = new StreamWriter(@"PradinaiDuomenys.txt"))
                for (int i = 0; i < 3; i++)
                {
                    writer.WriteLine("--------------------------------------------Ratas-{0}-----------------------------------------", zaidimai[i].Ratas);
                    writer.WriteLine();
                    for (int j = 0; j < zaidimai[i].ZaidCount; j++)
                    {
                        writer.WriteLine(zaidimai[i].Zaidejai[j].ToString());
                        // writer.WriteLine("{0,-10} | {1,-15} | {2,-15} | {3,-10} | {4,-10} | {5,-5} | {6,-5} | {7,-5}", zaidimai[i].Zaidejai[j].Vardas, zaidimai[i].Zaidejai[j].Pavarde, zaidimai[i].Zaidejai[j].Komanda, zaidimai[i].Zaidejai[j].Pozicija, zaidimai[i].Zaidejai[j].Cemp, zaidimai[i].Zaidejai[j].Sunaik, zaidimai[i].Zaidejai[j].Zuvo, zaidimai[i].Zaidejai[j].Dalyvav);
                        // panaudoju ToString
                    }
                    writer.WriteLine();
                }

            GerAsmRez(zaidimai);
            UniversaliausiasCemp(zaidimai);
            PakiteZaidejai(zaidimai);
            TopPozicija(zaidimai);



// suraso visas skirtingas pozicijas


            Turnyras[] VisiZaid = new Turnyras[MaxZaid];

            int count = 0; //suraso visu triju ratu info i viena masyva

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < zaidimai[i].ZaidCount; j++)
                {
                    if (!VisiZaid.Contains(zaidimai[i].Zaidejai[j]))
                    {
                        VisiZaid[count] = zaidimai[i].Zaidejai[j];
                        count++;
                    }
                }
            }
            // suraso pozicijas i viena masyva
            string[] PozMas = new string[count];

            for (int i = 0; i < count; i++)
            {
                PozMas[i] = VisiZaid[i].Pozicija;
            }

            int newcount = 0;

            string[] NewMas = new string[count];

            for (int i = 0; i < 1; i++)
            {
                NewMas[i] = PozMas[i];
                newcount++;
            }
            int a;

            for (int i = 0; i < count; i++)
            {
                a = 0;
                for (int j = 0; j < newcount; j++)
                {
                    if (PozMas[i] != NewMas[j])
                    {
                        a += 1;
                    }
                }
                if (a == newcount)
                {
                    NewMas[newcount] = PozMas[i];
                    newcount++;
                }
            }
            Console.WriteLine();
            Console.WriteLine("Pozicijos, kurios yra:");
            for (int i = 0; i < newcount; i++)
            {
                Console.WriteLine("{0}", NewMas[i]);
            }
        }