static List <CarForExcel> HandleTable(object[,] fulltable)
        {
            List <CarForExcel> cartable = new List <CarForExcel>();

            for (int i = 0; i < rows; i++)
            {
                CarForExcel car = new CarForExcel();
                car.country      = fulltable[i + 1, 4].ToString();
                car.manufacturer = fulltable[i + 1, 5].ToString();
                car.model        = fulltable[i + 1, 6].ToString();
                car.year         = fulltable[i + 1, 7].ToString();
                car.rarity       = fulltable[i + 1, 2].ToString();
                car.tires        = fulltable[i + 1, 15].ToString();
                car.rq           = fulltable[i + 1, 3].ToString();
                car.drive        = fulltable[i + 1, 13].ToString();
                car.fuel         = fulltable[i + 1, 23].ToString();
                car.body         = fulltable[i + 1, 24].ToString();
                car.seats        = fulltable[i + 1, 25].ToString();
                try
                {
                    car.tags = fulltable[i + 1, 26].ToString();
                }
                catch (Exception ex)
                {
                }
                car.clearance    = fulltable[i + 1, 18].ToString();
                car.acceleration = fulltable[i + 1, 9].ToString();
                car.speed        = fulltable[i + 1, 8].ToString();
                car.grip         = fulltable[i + 1, 12].ToString();
                cartable.Add(car);
            }

            return(cartable);
        }
Пример #2
0
 public static bool SearchTag(CarForExcel car, string tag)
 {
     if (car.tags != null)
     {
         return(car.tags.Contains(tag));
     }
     return(false);
 }
Пример #3
0
 public static bool SearchBody(CarForExcel car, string bodytype)
 {
     return(car.body.Contains(bodytype));
 }
Пример #4
0
        public static bool SatisfyCondition(string cond, CarForExcel car)
        {
            bool   x = false;
            int    year;
            string tag;
            string bodytype;

            switch (cond)
            {
            case "empty":
                x = true;
                break;

            case "задний привод":
                if (car.drive == "rwd")
                {
                    x = true;
                }
                break;

            case "передний привод":
                if (car.drive == "fwd")
                {
                    x = true;
                }
                break;

            case "обычная х3":
                x = true;
                break;

            case "audi":
                if (car.manufacturer == "Audi")
                {
                    x = true;
                }
                break;

            case "audi x3":
                if (car.manufacturer == "Audi")
                {
                    x = true;
                }
                break;

            case "бензиновые машины":
                if (car.fuel == "petrol")
                {
                    x = true;
                }
                break;

            case "дизели":
                if (car.fuel == "diesel")
                {
                    x = true;
                }
                break;

            case "обычная":
                if (car.rarity == "f")
                {
                    x = true;
                }
                break;

            case "обычная х2":
                if (car.rarity == "f")
                {
                    x = true;
                }
                break;

            case "необычная":
                if (car.rarity == "e")
                {
                    x = true;
                }
                break;

            case "машины японии":
                if (car.country == "Japan")
                {
                    x = true;
                }
                break;

            case "машины японии х3":
                if (car.country == "Japan")
                {
                    x = true;
                }
                break;

            case "jaguar":
                if (car.manufacturer == "Jaguar")
                {
                    x = true;
                }
                break;

            case "jaguar x3":
                if (car.manufacturer == "Jaguar")
                {
                    x = true;
                }
                break;

            case "машины сша":
                if (car.country == "United States")
                {
                    x = true;
                }
                break;

            case "italian 60s-80s":
                if (car.country == "Italy")
                {
                    year = Convert.ToInt32(car.year);
                    if (year > 1959 && year < 1990)
                    {
                        x = true;
                    }
                }
                break;

            case "редкостная":
                if (car.rarity == "d")
                {
                    x = true;
                }
                break;

            case "редкостная х2":
                if (car.rarity == "d")
                {
                    x = true;
                }
                break;

            case "экстремальная":
                if (car.rarity == "b")
                {
                    x = true;
                }
                break;

            case "standard tyres":
            case "standard tires":
                if (car.tires == "std")
                {
                    x = true;
                }
                break;

            case "пикапы":
                bodytype = "pickup";
                x        = SearchBody(car, bodytype);
                break;

            case "mercedes-benz":
                if (car.manufacturer == "Mercedes-Benz")
                {
                    x = true;
                }
                break;

            case "renault":
                if (car.manufacturer == "Renault")
                {
                    x = true;
                }
                break;

            case "renault x3":
                if (car.manufacturer == "Renault")
                {
                    x = true;
                }
                break;

            case "suzuki x3":
                if (car.manufacturer == "Suzuki")
                {
                    x = true;
                }
                break;

            case "nissan x3":
                if (car.manufacturer == "Nissan")
                {
                    x = true;
                }
                break;

            case "полный привод":
                if (car.drive == "4wd")
                {
                    x = true;
                }
                break;

            case "машины англии":
                if (car.country == "United Kingdom")
                {
                    x = true;
                }
                break;

            case "chrysler":
                if (car.manufacturer == "Chrysler")
                {
                    x = true;
                }
                break;

            case "chrysler x3":
                if (car.manufacturer == "Chrysler")
                {
                    x = true;
                }
                break;

            case "peugeot":
                if (car.manufacturer == "Peugeot")
                {
                    x = true;
                }
                break;

            case "peugeot x3":
                if (car.manufacturer == "Peugeot")
                {
                    x = true;
                }
                break;

            case "honda":
                if (car.manufacturer == "Honda")
                {
                    x = true;
                }
                break;

            case "honda x3":
                if (car.manufacturer == "Honda")
                {
                    x = true;
                }
                break;

            case "alfa romeo":
                if (car.manufacturer == "Alfa Romeo")
                {
                    x = true;
                }
                break;

            case "alfa romeo x3":
                if (car.manufacturer == "Alfa Romeo")
                {
                    x = true;
                }
                break;

            case "французский ренессанс":
                tag = "French Renaissance";
                x   = SearchTag(car, tag);
                break;

            case "машины франции":
                if (car.country == "France")
                {
                    x = true;
                }
                break;

            case "машины франции х2":
                if (car.country == "France")
                {
                    x = true;
                }
                break;

            case "all-surface tyres":
                if (car.tires == "all")
                {
                    x = true;
                }
                break;

            case "ford":
                if (car.manufacturer == "Ford")
                {
                    x = true;
                }
                break;

            case "bmw":
                if (car.manufacturer == "BMW")
                {
                    x = true;
                }
                break;

            case "bmw x3":
                if (car.manufacturer == "BMW")
                {
                    x = true;
                }
                break;

            case "машины италии":
                if (car.country == "Italy")
                {
                    x = true;
                }
                break;

            case "5-местные":
                if (Convert.ToInt32(car.seats) == 5)
                {
                    x = true;
                }
                break;

            case "mazda":
                if (car.manufacturer == "Mazda")
                {
                    x = true;
                }
                break;

            case "машины германии":
                if (car.country == "Germany")
                {
                    x = true;
                }
                break;

            case "американская мечта":
                tag = "American Dream";
                x   = (SearchTag(car, tag));
                break;

            case "dodge":
                if (car.manufacturer == "Dodge")
                {
                    x = true;
                }
                break;

            case "dodge x3":
                if (car.manufacturer == "Dodge")
                {
                    x = true;
                }
                break;

            case "суперская":
                if (car.rarity == "c")
                {
                    x = true;
                }
                break;

            case "машины 1980":
                year = Convert.ToInt32(car.year);
                if (year > 1979 && year < 1990)
                {
                    x = true;
                }
                break;

            case "porsche":
                if (car.manufacturer == "Porsche")
                {
                    x = true;
                }
                break;

            case "mercedes-benz x3":
                if (car.manufacturer == "Mercedes-Benz")
                {
                    x = true;
                }
                break;

            case "opel":
                if (car.manufacturer == "Vauxhall")
                {
                    x = true;
                }
                break;

            case "2-местные":
                if (Convert.ToInt32(car.seats) == 2)
                {
                    x = true;
                }
                break;

            case "2000s 4wd":
                year = Convert.ToInt32(car.year);
                if (car.drive == "4wd" && (year > 1999 && year < 2010))
                {
                    x = true;
                }
                break;

            case "седаны":
                bodytype = "sedan";
                x        = SearchBody(car, bodytype);
                break;

            case "горячий хэтчбек":
                tag = "Hot Hatch";
                x   = SearchTag(car, tag);
                break;

            case "экологичная":
                tag = "Eco Friendly";
                x   = (SearchTag(car, tag));
                break;

            case "italian renaissance":
                tag = "Italian Renaissance";
                x   = (SearchTag(car, tag));
                break;

            case "italian renaissance x3":
                tag = "Italian Renaissance";
                x   = (SearchTag(car, tag));
                break;

            case "cadillac":
                if (car.manufacturer == "Cadillac")
                {
                    x = true;
                }
                break;

            case "cadillac x3":
                if (car.manufacturer == "Cadillac")
                {
                    x = true;
                }
                break;

            case "citroen":
                if (car.manufacturer == "Citroen")
                {
                    x = true;
                }
                break;

            case "citroen x3":
                if (car.manufacturer == "Citroen")
                {
                    x = true;
                }
                break;

            case "pre-1970":
                year = Convert.ToInt32(car.year);
                if (year < 1970)
                {
                    x = true;
                }
                break;

            case "pontiac":
                if (car.manufacturer == "Pontiac")
                {
                    x = true;
                }
                break;

            case "pontiac x3":
                if (car.manufacturer == "Pontiac")
                {
                    x = true;
                }
                break;

            case "1975-1984":
                year = Convert.ToInt32(car.year);
                if (year > 1974 && year < 1985)
                {
                    x = true;
                }
                break;

            case "немецкое возрождение":
                tag = "German Renaissance";
                x   = (SearchTag(car, tag));
                break;

            case "немецкое возрождение х3":
                tag = "German Renaissance";
                x   = (SearchTag(car, tag));
                break;

            case "fiat":
                if (car.manufacturer == "Fiat")
                {
                    x = true;
                }
                break;

            case "fiat x3":
                if (car.manufacturer == "Fiat")
                {
                    x = true;
                }
                break;

            case "nissan":
                if (car.manufacturer == "Nissan")
                {
                    x = true;
                }
                break;

            case "chevrolet":
                if (car.manufacturer == "Chevrolet")
                {
                    x = true;
                }
                break;

            case "chevrolet x3":
                if (car.manufacturer == "Chevrolet")
                {
                    x = true;
                }
                break;

            case "2000-2004":
                year = Convert.ToInt32(car.year);
                if (year > 1999 && year < 2005)
                {
                    x = true;
                }
                break;

            case "икона стиля":
                tag = "Style Icon";
                x   = (SearchTag(car, tag));
                break;

            case "2005-2009":
                year = Convert.ToInt32(car.year);
                if (year > 2004 && year < 2010)
                {
                    x = true;
                }
                break;

            case "1985-1994":
                year = Convert.ToInt32(car.year);
                if (year > 1984 && year < 1995)
                {
                    x = true;
                }
                break;

            case "subaru":
                if (car.manufacturer == "Subaru")
                {
                    x = true;
                }
                break;

            case "subaru x3":
                if (car.manufacturer == "Subaru")
                {
                    x = true;
                }
                break;

            case "автоспорт":
                tag = "Motorsport";
                x   = (SearchTag(car, tag));
                break;

            case "отк. верх":
            case "отк.верх":
                bool x1;
                bool x2;
                bodytype = "roadster";
                x1       = SearchBody(car, bodytype);
                bodytype = "cabrio";
                x2       = SearchBody(car, bodytype);
                if (x1 || x2)
                {
                    x = true;
                }
                break;

            case "машины 1990":
                year = Convert.ToInt32(car.year);
                if (year > 1989 && year < 2000)
                {
                    x = true;
                }
                break;

            case "2000 rwd":
                if (car.drive == "rwd")
                {
                    year = Convert.ToInt32(car.year);
                    if (year > 1999 && year < 2010)
                    {
                        x = true;
                    }
                }
                break;

            case "машины 1970":
                year = Convert.ToInt32(car.year);
                if (year > 1969 && year < 1980)
                {
                    x = true;
                }
                break;

            case "машины италии х3":
                if (car.country == "Italy")
                {
                    x = true;
                }
                break;

            case "машины италии х2":
                if (car.country == "Italy")
                {
                    x = true;
                }
                break;

            case "машины франции х3":
                if (car.country == "France")
                {
                    x = true;
                }
                break;

            case "машины англии х3":
                if (car.country == "United Kingdom")
                {
                    x = true;
                }
                break;

            case "машины англии х2":
                if (car.country == "United Kingdom")
                {
                    x = true;
                }
                break;

            case "машины японии х2":
                if (car.country == "Japan")
                {
                    x = true;
                }
                break;

            case "машины германии х2":
                if (car.country == "Germany")
                {
                    x = true;
                }
                break;

            case "машины германии х3":
                if (car.country == "Germany")
                {
                    x = true;
                }
                break;

            case "german 2015-2019 x3":
                if (car.country == "Germany")
                {
                    year = Convert.ToInt32(car.year);
                    if (year > 2014 && year < 2020)
                    {
                        x = true;
                    }
                }
                break;

            case "машины сша х2":
                if (car.country == "United States")
                {
                    x = true;
                }
                break;

            case "машины сша х3":
                if (car.country == "United States")
                {
                    x = true;
                }
                break;

            case "ford x3":
                if (car.manufacturer == "Ford")
                {
                    x = true;
                }
                break;

            case "opel x3":
                if (car.manufacturer == "Vauxhall")
                {
                    x = true;
                }
                break;

            case "необычная х3":
                if (car.rarity == "e")
                {
                    x = true;
                }
                break;

            case "суперская х2":
                if (car.rarity == "c")
                {
                    x = true;
                }
                break;

            case "german 2010-2014 x3":
                if (car.country == "German")
                {
                    year = Convert.ToInt32(car.year);
                    if (year > 2009 && year < 2015)
                    {
                        x = true;
                    }
                }
                break;

            case "italian 90s x3":
                if (car.country == "Italy")
                {
                    year = Convert.ToInt32(car.year);
                    if (year > 1989 && year < 2000)
                    {
                        x = true;
                    }
                }
                break;

            default:
                NotePad.DoErrorLog("don't know condition: " + cond);
                x = false;
                break;
            }
            return(x);
        }