Пример #1
0
        static void cashSR()
        {
            if (File.Exists(cashCarsPath))
            {
                using (StreamReader sr = new StreamReader(cashCarsPath, System.Text.Encoding.Default))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null && line != " " && line != "")
                    {
                        string carname = NotePad.GetWordFromString(line, 2);
                        int    amount  = Convert.ToInt32(NotePad.GetWordFromString(line, 1));

                        foreach (CarForExcel car in fulltablearray)
                        {
                            if (car.fullname() == carname)
                            {
                                fulltablearray.Find(thecar => thecar.fullname() == carname).amount = amount;
                                break;
                            }
                        }
                    }
                    sr.Close();
                }
            }
        }
        public static string[,] ReadInfoFromTXT(string path)
        {
            int length = GetInfoFileLength(path);

            string[,] picturetoname = new string[length, 2];

            using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default))
            {
                for (int i = 0; i < length; i++)
                {
                    string theline = sr.ReadLine();
                    picturetoname[i, 0] = NotePad.GetWordFromString(theline, 1);
                    picturetoname[i, 1] = NotePad.GetWordFromString(theline, 2);
                }
                sr.Close();
            }

            return(picturetoname);
        }
Пример #3
0
        static void PictureToNameTable()
        {
            using (StreamReader sr = new StreamReader(pictureToCarPath, System.Text.Encoding.Default))
            {
                string line;
                while ((line = sr.ReadLine()) != null && line != " " && line != "")
                {
                    string carname       = NotePad.GetWordFromString(line, 2);
                    int    pictureNumber = Convert.ToInt32(NotePad.GetWordFromString(line, 1));

                    foreach (CarForExcel car in fulltablearray)
                    {
                        if (car.fullname() == carname)
                        {
                            fulltablearray.Find(thecar => thecar.fullname() == carname).pictureNumber = pictureNumber;
                            break;
                        }
                    }
                }
                sr.Close();
            }
        }
Пример #4
0
        void IdentifyCar(int carPicture)
        {
            string path = @"C:\Bot\NewPL\PictureToCar.txt";

            using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default))
            {
                string line;
                while ((line = sr.ReadLine()) != null && line != " " && line != "")
                {
                    if (carPicture.ToString().Equals(NotePad.GetWordFromString(line, 1)))
                    {
                        carname = NotePad.GetWordFromString(line, 2);
                        NotePad.DoLog("машина определена: " + carname);
                        break;
                    }
                }
                sr.Close();
            }

            if (carname == "unknown" && carPicture != 10000)
            {
                NotePad.DoErrorLog(carPicture + " is unknown car");
            }
        }