コード例 #1
0
        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);
        }
コード例 #2
0
 protected override void Save(IniFileSection section)
 {
     base.Save(section);
     section.Set("LAPS", LapsCount);
     section.Set("WAIT_TIME", WaitTime.TotalSeconds); // round?
     section.SetIntEnum("IS_OPEN", JoinType);
 }
コード例 #3
0
 public void SaveTo(IniFileSection section)
 {
     section.Set("GRAPHICS", WeatherId);
     section.Set("BASE_TEMPERATURE_AMBIENT", BaseAmbientTemperature);
     section.Set("BASE_TEMPERATURE_ROAD", BaseRoadTemperature);
     section.Set("VARIATION_AMBIENT", AmbientTemperatureVariation);
     section.Set("VARIATION_ROAD", RoadTemperatureVariation);
 }
コード例 #4
0
 public void SaveTo(IniFileSection section)
 {
     section.Set("POSX", PosX);
     section.Set("POSY", PosY);
     section.Set("VISIBLE", IsVisible);
     section.Set("BLOCKED", IsBlocked);
     section.Set("SCALE", Scale.ToDoublePercentage());
 }
コード例 #5
0
 public void SaveTo(IniFileSection section)
 {
     section.SetOrRemove("MODEL", CarId);
     section.SetOrRemove("SKIN", CarSkinId);
     section.SetOrRemove("SPECTATOR_MODE", SpectatorMode);
     section.SetOrRemove("DRIVERNAME", DriverName);
     section.SetOrRemove("TEAM", TeamName);
     section.SetOrRemove("GUID", Guid);
     section.Set("BALLAST", Ballast);
     section.Set("RESTRICTOR", Restrictor);
 }
コード例 #6
0
            public void Set(IniFileSection section)
            {
                if (Preset.HasValue)
                {
                    section.Set("PRESET", Preset);
                }
                else
                {
                    section.Remove("PRESET");
                }

                section.Set("SESSION_START", SessionStart);
                section.Set("RANDOMNESS", Randomness);
                section.Set("LAP_GAIN", LapGain);
                section.Set("SESSION_TRANSFER", SessionTransfer);
            }
コード例 #7
0
ファイル: SidekickHelper.cs プロジェクト: WildGenie/actools
        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);
        }
コード例 #8
0
ファイル: GraphicsSettings.cs プロジェクト: gro-ove/actools
        private bool FixShadowMapBias(IniFileSection section) {
            var result = false;
            if (!section.ContainsKey("SHADOW_MAP_BIAS_0")) {
                result = true;
                section.Set("SHADOW_MAP_BIAS_0", "0.000002");
            }

            if (!section.ContainsKey("SHADOW_MAP_BIAS_1")) {
                result = true;
                section.Set("SHADOW_MAP_BIAS_1", "0.000015");
            }

            if (!section.ContainsKey("SHADOW_MAP_BIAS_2")) {
                result = true;
                section.Set("SHADOW_MAP_BIAS_2", "0.0003");
            }

            return result;
        }
コード例 #9
0
ファイル: GenericModsEnabler.cs プロジェクト: 2m/actools
        public static void SetGenericModDependancies(this IniFileSection section, string key, [CanBeNull] IEnumerable <string> values)
        {
            var v = values?.OrderBy(x => x).Select(x => $"\"{x}\"").JoinToString();

            if (string.IsNullOrWhiteSpace(v))
            {
                section.Remove(key);
            }
            else
            {
                section.Set(key, v);
            }
        }
コード例 #10
0
ファイル: WeatherProceduralHelper.cs プロジェクト: 2m/actools
        private static void MapOutputSection(object outputValue, IniFileSection resultSection, [Localizable(false)] params string[] keys)
        {
            switch (outputValue)
            {
            case IniFileSection e:
                foreach (var v in e)
                {
                    if (!(keys?.Length > 0) || keys.Contains(v.Key))
                    {
                        resultSection.Set(v.Key, v.Value);
                    }
                }
                break;

            case LuaIniSection e:
                foreach (var v in e.ToIniValues())
                {
                    if (!(keys?.Length > 0) || keys.Contains(v.Key))
                    {
                        resultSection.Set(v.Key, v.Value);
                    }
                }
                break;

            case Table o:
                foreach (var key in o.Keys)
                {
                    var keyString = key.CastToString();
                    if (!(keys?.Length > 0) || keys.Contains(keyString))
                    {
                        resultSection[keyString] = ToIniFileValue(o[key]);
                    }
                }
                break;
            }
        }
コード例 #11
0
ファイル: GraphicsSettings.cs プロジェクト: WildGenie/actools
        private bool FixShadowMapBias(IniFileSection section)
        {
            var result = false;

            if (!section.ContainsKey("SHADOW_MAP_BIAS_0"))
            {
                result = true;
                section.Set("SHADOW_MAP_BIAS_0", "0.000002");
            }

            if (!section.ContainsKey("SHADOW_MAP_BIAS_1"))
            {
                result = true;
                section.Set("SHADOW_MAP_BIAS_1", "0.000015");
            }

            if (!section.ContainsKey("SHADOW_MAP_BIAS_2"))
            {
                result = true;
                section.Set("SHADOW_MAP_BIAS_2", "0.0003");
            }

            return(result);
        }
コード例 #12
0
 public void SaveTo(IniFileSection section, bool allowCspOptions)
 {
     section.SetOrRemove("MODEL", CarId);
     if (allowCspOptions && CspOptions.Pack(out var packed))
     {
         section.Set("SKIN", CarSkinId + "/" + packed);
     }
     else
     {
         section.SetOrRemove("SKIN", CarSkinId);
     }
     section.Set("SPECTATOR_MODE", SpectatorMode);
     section.Set("DRIVERNAME", DriverName ?? "");
     section.Set("TEAM", TeamName ?? "");
     section.Set("GUID", Guid ?? "");
     section.Set("BALLAST", Ballast);
     section.Set("RESTRICTOR", Restrictor);
 }
コード例 #13
0
ファイル: ServerSessionEntry.cs プロジェクト: tankyx/actools
 protected virtual void Save(IniFileSection session, IniFileSection main)
 {
     session.Set("NAME", string.IsNullOrWhiteSpace(ConfigName) ? DisplayName : ConfigName);
     session.Set("TIME", Time.TotalMinutes); // round?
     session.Set("IS_OPEN", IsOpen);
 }
コード例 #14
0
 public static void Set(this IniFileSection section, [LocalizationRequired(false)] string key, SettingEntry entry)
 {
     section.Set(key, entry.Value);
 }
コード例 #15
0
 public static void Set(this IniFileSection section, [LocalizationRequired(false)] string key, Color entry, double multipler)
 {
     section.Set(key, $"{entry.R.ToInvariantString()},{entry.G.ToInvariantString()},{entry.B.ToInvariantString()},{multipler.ToInvariantString()}");
 }
コード例 #16
0
ファイル: ServerSessionEntry.cs プロジェクト: windygu/actools
 protected override void Save(IniFileSection session, IniFileSection main)
 {
     base.Save(session, main);
     main.Set("QUALIFY_MAX_WAIT_PERC", QualifyLimitPercentage);
 }
コード例 #17
0
 public static void SetSlimVector3(this IniFileSection section, string key, Vector3 value)
 {
     section.Set(key, value.ToArray());
 }
コード例 #18
0
ファイル: IniFileExtension.cs プロジェクト: mdupuis13/actools
 public static void SetNormalizedColor(this IniFileSection section, [LocalizationRequired(false)] string key, Color entry)
 {
     section.Set(key, $"{(entry.R / 255d).Round(0.001).ToInvariantString()},{(entry.G / 255d).Round(0.001).ToInvariantString()},{(entry.B / 255d).Round(0.001).ToInvariantString()}");
 }