Exemple #1
0
        public override Bolid FactoryMethod(Bolid bolid, List <string> fields)
        {
            NewBolid car = (NewBolid)bolid;

            fields.Add(car.name);
            fields.Add(car.engine);
            fields.Add(car.body);
            fields.Add(car.nose);
            fields.Add(car.RearWing);
            fields.Add(car.DownForce);
            fields.Add(car.FrontWing);
            fields.Add(car.Turbo);
            fields.Add(car.Kers);
            fields.Add(car.Drs);
            return(car);
        }
Exemple #2
0
        public override Bolids.Bolid FactoryMethod(List <string> fields)
        {
            NewBolid bolid = new NewBolid();

            bolid.name      = fields[0];
            bolid.engine    = fields[1];
            bolid.body      = fields[2];
            bolid.nose      = fields[3];
            bolid.RearWing  = fields[4];
            bolid.DownForce = fields[5];
            bolid.FrontWing = fields[6];
            bolid.Turbo     = fields[7];
            bolid.Kers      = fields[8];
            bolid.Drs       = fields[9];
            return(bolid);
        }
Exemple #3
0
        public static NewBolid NewBolidDeserialize(string str)
        {
            NewBolid newbolid     = new NewBolid();
            string   strName      = @"(?<=name:)([^;]*)";
            string   strBody      = @"(?<=body:)([^;]*)";
            string   strEngine    = @"(?<=engine:)([^;]*)";
            string   strNose      = @"(?<=nose:)([^;]*)";
            string   strRearWing  = @"(?<=rearwing:)([^;]*)";
            string   strDownForce = @"(?<=downforce:)([^;]*)";
            string   strFrontWing = @"(?<=frontwing:)([^;]*)";
            string   strDrs       = @"(?<=drs:)([^;]*)";
            string   strKers      = @"(?<=kers:)([^;]*)";
            string   strTurbo     = @"(?<=turbo:)([^;]*)";
            Regex    regName      = new Regex(strName);
            Regex    regBody      = new Regex(strBody);
            Regex    regEngine    = new Regex(strEngine);
            Regex    regNose      = new Regex(strNose);
            Regex    regRearWing  = new Regex(strRearWing);
            Regex    regDownForce = new Regex(strDownForce);
            Regex    regFrontWing = new Regex(strFrontWing);
            Regex    regDrs       = new Regex(strDrs);
            Regex    regKers      = new Regex(strKers);
            Regex    regTurbo     = new Regex(strTurbo);

            newbolid.name      = regName.Match(str).ToString();
            newbolid.body      = regBody.Match(str).ToString();
            newbolid.engine    = regEngine.Match(str).ToString();
            newbolid.nose      = regNose.Match(str).ToString();
            newbolid.DownForce = regDownForce.Match(str).ToString();
            newbolid.RearWing  = regRearWing.Match(str).ToString();
            newbolid.FrontWing = regFrontWing.Match(str).ToString();
            newbolid.Drs       = regDrs.Match(str).ToString();
            newbolid.Kers      = regKers.Match(str).ToString();
            newbolid.Turbo     = regTurbo.Match(str).ToString();
            return(newbolid);
        }
Exemple #4
0
 public NewBolidSerializer(NewBolid obj)
 {
     this.bolid = obj;
 }