Ejemplo n.º 1
0
        public rFactorCarWheels(IniScanner mHdv)
        {
            try
            {
            File = mHdv.TryGetString("GENERAL", "TireBrand");
            if (File.EndsWith(".tbc") == false)
                File = File + ".tbc";
            File = rFactor.Garage.Files.SearchFile(rFactor.Garage.GamedataDirectory, File);

            var sides = new string[4] {"FRONTLEFT","FRONTRIGHT","REARLEFT","REARRIGHT"};
                IniScanner mTyre = new IniScanner {IniFile = File};
                mTyre.Read();

                foreach (var side in sides)
                {
                    var brakeTempInfo = new string[4] {"40", "300", "500", "700"};
                    if(mHdv.Data.ContainsKey(side) && mHdv.Data[side].ContainsKey("brakeresponsecurve"))
                     brakeTempInfo = mHdv.TryGetData(side, "BrakeResponseCurve");

                    var brakeTempLow = double.Parse(brakeTempInfo[1]) + 273;
                    var brakeTempHigh = double.Parse(brakeTempInfo[3]) + 273;

                    var brakeFailureMain = mHdv.TryGetString(side, "BrakeFailure").Split(',');
                    var brakeFailure = double.Parse(brakeFailureMain[0]);

                    var optimalPressure = 158.25; // TODO
                    var radius = 0.3261; // TODO

                    rFactorCarWheel rcw = new rFactorCarWheel(radius, brakeTempHigh, brakeTempLow, brakeFailure,
                                                              optimalPressure);
                    switch (side)
                    {
                        case "FRONTLEFT":
                            LeftFront = rcw;
                            break;
                        case "FRONTRIGHT":
                            RightFront = rcw;
                            break;
                        case "REARLEFT":
                            LeftRear = rcw;
                            break;
                        case "REARRIGHT":
                            RightRear = rcw;
                            break;
                    }
                }
            }catch(Exception e)
            {
                LeftFront = new rFactorCarWheel();
                RightFront = new rFactorCarWheel();
                LeftRear = new rFactorCarWheel();
                RightRear = new rFactorCarWheel();
            }
        }
Ejemplo n.º 2
0
        public rFactorCarWheels(IniScanner mHdv)
        {
            try
            {
                File = mHdv.TryGetString("GENERAL", "TireBrand");
                if (File.EndsWith(".tbc") == false)
                {
                    File = File + ".tbc";
                }
                File = rFactor.Garage.Files.SearchFile(rFactor.Garage.GamedataDirectory, File);

                var sides = new string[4] {
                    "FRONTLEFT", "FRONTRIGHT", "REARLEFT", "REARRIGHT"
                };
                IniScanner mTyre = new IniScanner {
                    IniFile = File
                };
                mTyre.Read();

                foreach (var side in sides)
                {
                    var brakeTempInfo = new string[4] {
                        "40", "300", "500", "700"
                    };
                    if (mHdv.Data.ContainsKey(side) && mHdv.Data[side].ContainsKey("brakeresponsecurve"))
                    {
                        brakeTempInfo = mHdv.TryGetData(side, "BrakeResponseCurve");
                    }

                    var brakeTempLow  = double.Parse(brakeTempInfo[1]) + 273;
                    var brakeTempHigh = double.Parse(brakeTempInfo[3]) + 273;

                    var brakeFailureMain = mHdv.TryGetString(side, "BrakeFailure").Split(',');
                    var brakeFailure     = double.Parse(brakeFailureMain[0]);

                    var optimalPressure = 158.25; // TODO
                    var radius          = 0.3261; // TODO

                    rFactorCarWheel rcw = new rFactorCarWheel(radius, brakeTempHigh, brakeTempLow, brakeFailure,
                                                              optimalPressure);
                    switch (side)
                    {
                    case "FRONTLEFT":
                        LeftFront = rcw;
                        break;

                    case "FRONTRIGHT":
                        RightFront = rcw;
                        break;

                    case "REARLEFT":
                        LeftRear = rcw;
                        break;

                    case "REARRIGHT":
                        RightRear = rcw;
                        break;
                    }
                }
            }catch (Exception e)
            {
                LeftFront  = new rFactorCarWheel();
                RightFront = new rFactorCarWheel();
                LeftRear   = new rFactorCarWheel();
                RightRear  = new rFactorCarWheel();
            }
        }