Beispiel #1
0
        public override Formula1BolidHierarchy.Bolids.Bolid FactoryMethod(Formula1BolidHierarchy.Bolids.Bolid bolid, List <string> fields)
        {
            BolidHybrid car = (BolidHybrid)bolid;

            fields.Add(car.name);
            fields.Add(car.engine);
            fields.Add(car.body);
            fields.Add(car.Turbo);
            fields.Add(car.Wheels);
            return(car);
        }
Beispiel #2
0
        public override Formula1BolidHierarchy.Bolids.Bolid FactoryMethod(List <string> fields)
        {
            BolidHybrid bolid = new BolidHybrid();

            bolid.name   = fields[0];
            bolid.engine = fields[1];
            bolid.body   = fields[2];
            bolid.Wheels = fields[3];
            bolid.Turbo  = fields[4];
            return(bolid);
        }
Beispiel #3
0
        public override Formula1BolidHierarchy.Bolids.Bolid Deserialize(string deserializableString)
        {
            BolidHybrid bolid     = new BolidHybrid();
            string      strName   = @"(?<=name:)([^;]*)";
            string      strBody   = @"(?<=body:)([^;]*)";
            string      strEngine = @"(?<=engine:)([^;]*)";
            string      strWheels = @"(?<=wheels:)([^;]*)";
            string      strTurbo  = @"(?<=turbo:)([^;]*)";
            Regex       regName   = new Regex(strName);
            Regex       regBody   = new Regex(strBody);
            Regex       regEngine = new Regex(strEngine);
            Regex       regWheels = new Regex(strWheels);
            Regex       regTurbo  = new Regex(strTurbo);

            bolid.name   = regName.Match(deserializableString).ToString();
            bolid.body   = regBody.Match(deserializableString).ToString();
            bolid.engine = regEngine.Match(deserializableString).ToString();
            bolid.Wheels = regWheels.Match(deserializableString).ToString();
            bolid.Turbo  = regTurbo.Match(deserializableString).ToString();
            return(bolid);
        }