private static bool SetRange(IniFileSection section, string minKey, string maxKey, [CanBeNull] Tuple <double, double> range) { if (range == null) { return(false); } var min = Math.Min(range.Item1, range.Item2); var max = Math.Max(range.Item1, range.Item2); var changed = false; if (!Equals(section.GetDouble(maxKey, 0d), max)) { section.Set(maxKey, max); changed = true; } if (!Equals(section.GetDouble(minKey, 0d), min)) { section.Set(minKey, min); changed = true; } return(changed); }
public ServerWeatherEntry(IniFileSection section) { WeatherId = section.GetNonEmpty("GRAPHICS"); BaseAmbientTemperature = section.GetDouble("BASE_TEMPERATURE_AMBIENT", 18d); BaseRoadTemperature = section.GetDouble("BASE_TEMPERATURE_ROAD", 6d); AmbientTemperatureVariation = section.GetDouble("VARIATION_AMBIENT", 2d); RoadTemperatureVariation = section.GetDouble("VARIATION_ROAD", 1d); }
public static TurboDescription FromIniSection(IniFileSection turboSection) { return new TurboDescription { MaxBoost = turboSection.GetDouble("MAX_BOOST", 0d), Wastegate = turboSection.GetDouble("WASTEGATE", 0d), ReferenceRpm = turboSection.GetDouble("REFERENCE_RPM", 1000d), Gamma = turboSection.GetDouble("GAMMA", 1d) }; }
private SurfaceDescription(IniFileSection section) { Key = section.GetNonEmpty("KEY") ?? ""; IsValidTrack = section.GetBool("IS_VALID_TRACK", false); IsPitlane = section.GetBool("IS_PITLANE", false); DirtAdditive = section.GetDouble("DIRT_ADDITIVE", 0.0); Friction = section.GetDouble("FRICTION", 0.8); AudioEffect = section.GetNonEmpty("WAV"); }
public static TurboDescription FromIniSection(IniFileSection turboSection) { return(new TurboDescription { MaxBoost = turboSection.GetDouble("MAX_BOOST", 0d), Wastegate = turboSection.GetDouble("WASTEGATE", 0d), ReferenceRpm = turboSection.GetDouble("REFERENCE_RPM", 1000d), Gamma = turboSection.GetDouble("GAMMA", 1d) }); }
public static TurboControllerDescription FromIniSection(IniFileSection controllerSection) { return new TurboControllerDescription { UpLimit = controllerSection.GetDouble("UP_LIMIT", double.NaN), DownLimit = controllerSection.GetDouble("DOWN_LIMIT", double.NaN), Filter = controllerSection.GetDouble("FILTER", 0.99d), Combinator = controllerSection.GetEnum("COMBINATOR", Combinator.None), Input = controllerSection.GetEnum("INPUT", ControllerInput.None), Lut = controllerSection.GetLut("LUT") }; }
public static TurboControllerDescription FromIniSection(IniFileSection controllerSection) { return(new TurboControllerDescription { UpLimit = controllerSection.GetDouble("UP_LIMIT", double.NaN), DownLimit = controllerSection.GetDouble("DOWN_LIMIT", double.NaN), Filter = controllerSection.GetDouble("FILTER", 0.99d), Combinator = controllerSection.GetEnum("COMBINATOR", Combinator.None), Input = controllerSection.GetEnum("INPUT", ControllerInput.None), Lut = controllerSection.GetLut("LUT") }); }
/// <summary> /// Create a new AssistsViewModel which will load data from serialized string, but won’t /// save any changes if they will occur. /// </summary> /// <param name="section">INI-file section.</param> public static TrackStateViewModelBase CreateBuiltIn([NotNull] IniFileSection section) { return(new TrackStateViewModelBase(null, false) { GripStart = section.GetDouble("SESSION_START", 95d) / 100d, GripTransfer = section.GetDouble("SESSION_TRANSFER", 90d) / 100d, GripRandomness = section.GetDouble("RANDOMNESS", 2d) / 100d, LapGain = section.GetInt("LAP_GAIN", 132), Description = section.GetNonEmpty("DESCRIPTION") }); }
public ServerPresetDriverEntry(IniFileSection section) { CarId = section.GetNonEmpty("MODEL") ?? DefaultCarId; CarSkinId = section.GetNonEmpty("SKIN"); SpectatorMode = section.GetBool("SPECTATOR_MODE", false); DriverName = section.GetNonEmpty("DRIVERNAME"); TeamName = section.GetNonEmpty("TEAM"); Guid = section.GetNonEmpty("GUID"); Ballast = section.GetDouble("BALLAST", 0d); Restrictor = section.GetDouble("RESTRICTOR", 0d); }
public void LoadFrom(IniFileSection section) { PosX = section.GetInt("POSX", 0); PosY = section.GetInt("POSY", 0); IsVisible = section.GetBool("VISIBLE", false); IsBlocked = section.GetBool("BLOCKED", false); Scale = section.GetDouble("SCALE", 1d).ToIntPercentage(); }
private static bool SetRange(IniFileSection section, string key1, string key2, [CanBeNull] Tuple <double, double> range) { var changed = false; if (range != null && !Equals(section.GetDouble(key1, 0d), range.Item1)) { section.Set(key1, range.Item1); changed = true; } if (range != null && !Equals(section.GetDouble(key2, 0d), range.Item2)) { section.Set(key2, range.Item2); changed = true; } return(changed); }
public ServerPresetDriverEntry(IniFileSection section) { CarId = section.GetNonEmpty("MODEL") ?? DefaultCarId; var carSkinId = section.GetNonEmpty("SKIN")?.Split('/'); CarSkinId = carSkinId?[0]; CspOptions.LoadPacked(carSkinId?.ElementAtOrDefault(1)); SpectatorMode = section.GetBool("SPECTATOR_MODE", false); DriverName = section.GetNonEmpty("DRIVERNAME"); TeamName = section.GetNonEmpty("TEAM"); Guid = section.GetNonEmpty("GUID"); Ballast = section.GetDouble("BALLAST", 0d); Restrictor = section.GetDouble("RESTRICTOR", 0d); CspOptions.PropertyChanged += (sender, args) => { Logging.Write($"ARG: {args.PropertyName}"); // ReSharper disable once NotResolvedInText OnPropertyChanged(@"CspOptions.Inner"); }; }
public CarSetupEntry([NotNull] string key, IniFileSection section, [CanBeNull] AcLocaleProvider localeProvider, [NotNull] DataWrapper data) { Key = key; DisplayName = localeProvider?.GetString("SETUP", section.GetNonEmpty("NAME")) ?? CarSetupObject.FixEntryName(section.GetNonEmpty("NAME"), false) ?? key; HelpInformation = localeProvider?.GetString(AcLocaleProvider.CategoryTag, section.GetNonEmpty("HELP")) ?? section.GetNonEmpty("HELP"); var ratios = section.GetNonEmpty("RATIOS"); if (ratios != null) { Values = data.GetRtoFile(ratios).Values; Minimum = 0; Maximum = Values.Count - 1; Step = 1; StepsMode = CarSetupStepsMode.Steps; TabKey = "GEARS"; } else { Minimum = section.GetDouble("MIN", 0); Maximum = section.GetDouble("MAX", Minimum + 100); Step = FixedStep(key) ?? section.GetDouble("STEP", 1d); StepsMode = section.GetIntEnum("SHOW_CLICKS", CarSetupStepsMode.ActualValue); UnitsPostfix = StepsMode == CarSetupStepsMode.ActualValue ? GetUnitsPostfix(key) : null; TabKey = section.GetNonEmpty("TAB"); } var defaultValue = GetDefaultValue(key, data); DefaultValue = defaultValue ?? (Minimum + Maximum) / 2f; HasDefaultValue = defaultValue.HasValue; var range = Maximum - Minimum; VisualStep = range / Step < 10 ? Step : range / 10; }
protected virtual void Load(IniFileSection session, IniFileSection main) { ConfigName = session.GetNonEmpty("NAME") ?? DisplayName; Time = TimeSpan.FromMinutes(session.GetDouble("TIME", 10d)); IsOpen = session.GetBool("IS_OPEN", true); }