Ejemplo n.º 1
0
 public override void ApplyParameter(IniValueObject obj)
 {
     base.ApplyParameter(obj);
     switch(obj.Key)
     {
         case "Ets2Engine":
             Ets2Torque = obj.ReadAsFloat();
             break;
     }
 }
Ejemplo n.º 2
0
        public void ApplyParameter(IniValueObject obj)
        {
            switch (obj.Key)
            {
                case "Frame":
                    var thr = obj.ReadAsFloat(0);
                    var clt = obj.ReadAsFloat(1);
                    var thrAbs = obj.ReadAsString(2);
                    var gear = obj.ReadAsString(3);

                    var useNewGear = gear == "new";
                    var useOldGear = gear == "old";
                    var absoluteThrottle = thrAbs == "abs";

                    var frame = new ShiftPatternFrame(clt, thr, absoluteThrottle, useOldGear, useNewGear);

                    Frames.Add(frame);
                    break;
            }
        }
Ejemplo n.º 3
0
        public void ApplyParameter(IniValueObject obj)
        {
            switch(obj.Key)
            {
                case "Adaptive":
                    Adaptive = obj.ReadAsInteger() == 1;
                    break;

                case "Limit":
                    SpeedLimit = obj.ReadAsInteger();
                    break;

                case "Slope":
                    SpeedSlope = obj.ReadAsFloat();
                    break;

                case "Disable":
                    Enabled = false;
                    break;
            }
        }
Ejemplo n.º 4
0
        public void ApplyParameter(IniValueObject obj)
        {
            switch (obj.Key)
            {
                case "Load":
                    var p = new Profile(this, obj.ReadAsString());
                    if(p.Loaded==false)
                    {
                        Unloaded.Add(obj.ReadAsString());
                    }
                    else
                    {
                        Loaded.Add(p);
                    }
                    break;

                case "Unload":
                    Unloaded.Add(obj.ReadAsString());
                    break;
            }
        }
Ejemplo n.º 5
0
        public virtual void ApplyParameter(IniValueObject obj)
        {
            if (obj.Group == "Engine")
            {
                switch (obj.Key)
                {
                    case "Idle":
                        StallRpm = obj.ReadAsFloat();
                        break;
                    case "Max":
                        MaximumRpm = obj.ReadAsFloat();
                        break;

                    case "Power":
                        Engine.Add(obj.ReadAsFloat(0), new GenericEngineData(obj.ReadAsFloat(1), obj.ReadAsFloat(2)));
                        break;
                }
            }
            else if (obj.Group == "Gearbox")
            {
                switch(obj.Key)
                {
                    case"Gears":
                        Gears = obj.ReadAsInteger();
                        GearRatios = new double[Gears];
                        break;

                    case "Gear":
                        GearRatios[obj.ReadAsInteger(0)] = obj.ReadAsFloat(1);
                        break;

                    case "GearR":
                        GearReverse = obj.ReadAsFloat();
                        break;

                }
            }
        }
Ejemplo n.º 6
0
        public void ApplyParameter(IniValueObject obj)
        {
            switch(obj.Key)
            {
                case "ShiftDeadSpeed":
                    ShiftDeadSpeed = obj.ReadAsInteger();
                    break;
                case "ShiftDeadTime":
                    ShiftDeadTime = obj.ReadAsInteger();
                    break;

                case "GenerateSpeedHoldoff":
                    speedHoldoff = obj.ReadAsInteger();
                    break;

                case "EnableSportShiftdown":
                    EnableSportShiftdown = obj.ReadAsInteger() == 1;
                    break;

                case "KickdownEnable":
                    KickdownEnable = obj.ReadAsString() == "1";
                    break;
                case "KickdownTimeout":
                    KickdownTimeout = obj.ReadAsDouble();
                    break;
                case "KickdownSpeedReset":
                    KickdownSpeedReset = obj.ReadAsDouble();
                    break;
                case "KickdownPowerReset":
                    KickdownPowerReset = obj.ReadAsDouble();
                    break;
                case "KickdownRpmReset":
                    KickdownRpmReset = obj.ReadAsDouble();
                    break;

                case "PowerShift":
                    PowerShift = obj.ReadAsInteger() == 1;
                    break;

                case "Generate":
                    var def = ShifterTableConfigurationDefault.PeakRpm;
                    GeneratedShiftTable = obj.ReadAsString();
                    switch (GeneratedShiftTable)
                    {
                        case "Economy":
                            def = ShifterTableConfigurationDefault.Economy;
                            break;
                        case "Efficiency":
                            def = ShifterTableConfigurationDefault.Efficiency;
                            break;
                        case "Efficiency2":
                            def = ShifterTableConfigurationDefault.PowerEfficiency;
                            break;
                        case "Opa":
                            def = ShifterTableConfigurationDefault.AlsEenOpa;
                            break;
                        case "PeakRpm":
                            def = ShifterTableConfigurationDefault.PeakRpm;
                            break;
                        case "Performance":
                            def = ShifterTableConfigurationDefault.Performance;
                            break;
                        case "Henk":
                            def = ShifterTableConfigurationDefault.Henk;
                            break;
                    }

                    configuration = new ShifterTableConfiguration(def, Main.Drivetrain, speedHoldoff, StaticMass);
                    break;
            }
        }
Ejemplo n.º 7
0
 public void ApplyParameter(IniValueObject obj)
 {
     switch(obj.Key)
     {
         case "Antistall":
             Antistall = obj.ReadAsString();
             break;
         case "CruiseControl":
             CruiseControl= obj.ReadAsString();
             break;
         case "ShiftCurve":
             ShiftCurve = obj.ReadAsString();
             break;
         case "SpeedLimiter":
             SpeedLimiter = obj.ReadAsString();
             break;
         case "TractionControl":
             TractionControl = obj.ReadAsString();
             break;
         case "ShiftPattern":
             var file = obj.ReadAsString(2);
             var region = obj.ReadAsString(0).ToLower() + "_" + obj.ReadAsString(1) + "thr";
             ShiftPattern.Add(new ConfigurableShiftPattern(region, file));
             break;
     }
 }
Ejemplo n.º 8
0
        public void Parse()
        {
            if (Filedata == string.Empty)
            {
                throw new Exception("No data assigned to this reader");
            }

            var filelines = Filedata.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(x => x.Contains("//") ? x.Remove(x.IndexOf("//")).Trim() : x.Trim()).Where(x => x.Length != 0).ToList();

            ApplyGroup("Main", false);

            for (var i = 0; i < filelines.Count; i++)
            {
                var line     = filelines[i];
                var nextLine = (i + 1 == filelines.Count) ? "" : filelines[i + 1];

                if (line == "{")
                {
                    continue;
                }

                if (line.StartsWith("[") && line.EndsWith("]"))
                {
                    if (line.Length < 3)
                    {
                        ApplyGroup("", false);
                    }
                    ApplyGroup(line.Substring(1, line.Length - 2), false);
                    continue;
                }

                if (line == "}")
                {
                    LeaveGroup(true);
                    continue;
                }

                if (nextLine == "{")
                {
                    // This is a header.
                    ApplyGroup(line, true);
                    continue;
                }

                // Parse this value.
                var key   = "";
                var value = "";

                if (line.Contains("="))
                {
                    var data = line.Split(new[] { '=' }, 2);
                    key   = data[0].Trim();
                    value = data[1].Trim();
                }
                else
                {
                    value = line;
                }

                var obj = new IniValueObject(_group, key, value);

                foreach (var handler in _handlers)
                {
                    handler(obj);
                }
            }
        }
Ejemplo n.º 9
0
        public void ApplyParameter(IniValueObject obj)
        {
            switch(obj.Key)
            {
                case "Slope":
                    Slope = obj.ReadAsFloat();
                    break;

                case "Slip":
                    AllowedSlip = obj.ReadAsFloat();
                    break;
            }
        }
Ejemplo n.º 10
0
        public void ApplyParameter(IniValueObject obj)
        {
            switch (obj.Key)
            {
                case "P":
                    PSlope = obj.ReadAsFloat();
                    break;
                case "Imax":
                    Imax = obj.ReadAsFloat();
                    break;
                case "I":
                    ISlope = obj.ReadAsFloat();
                    break;
                case "D":
                    DSlope = obj.ReadAsFloat();
                    break;

                    // TODO: implement PID
            }
        }
Ejemplo n.º 11
0
 public void ApplyParameter(IniValueObject obj)
 {
     switch(obj.Key)
     {
         case "MinClutch":
             MinClutch = obj.ReadAsDouble();
             break;
         case "ThrottleSensitivity":
             ThrottleSensitivity = obj.ReadAsDouble();
             break;
     }
 }
Ejemplo n.º 12
0
        public void Parse()
        {
            if (Filedata == string.Empty)
                throw new Exception("No data assigned to this reader");

            var filelines = Filedata
                .Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
                .Select(x => x.Contains("//") ? x.Remove(x.IndexOf("//")).Trim() : x.Trim())
                .Where(x => x.Length != 0)
                .ToList();

            ApplyGroup("Main", false);

            for (var i = 0; i < filelines.Count; i++)
            {
                var line = filelines[i];
                var nextLine = (i + 1 == filelines.Count) ? "" : filelines[i + 1];

                if (line == "{") continue;

                if (line.StartsWith("[") && line.EndsWith("]"))
                {
                    if (line.Length < 3)
                        ApplyGroup("", false);
                    ApplyGroup(line.Substring(1, line.Length - 2), false);
                    continue;
                }

                if (line == "}")
                {
                    LeaveGroup(true);
                    continue;
                }

                if (nextLine == "{")
                {
                    // This is a header.
                    ApplyGroup(line, true);
                    continue;
                }

                // Parse this value.
                var key = "";
                var value = "";

                if (line.Contains("="))
                {
                    var data = line.Split(new[] { '=' }, 2);
                    key = data[0].Trim();
                    value = data[1].Trim();
                }
                else
                {
                    value = line;
                }

                var obj = new IniValueObject(_group, key, value);

                foreach (var handler in _handlers)
                    handler(obj);

            }
        }