OpenRA.MapPreview.InnerData.SetRulesetGenerator C# (CSharp) Method

SetRulesetGenerator() public method

public SetRulesetGenerator ( OpenRA.ModData modData, bool>.Func generator ) : void
modData OpenRA.ModData
generator bool>.Func
return void
            public void SetRulesetGenerator(ModData modData, Func<Pair<Ruleset, bool>> generator)
            {
                InvalidCustomRules = false;
                RulesLoaded = false;
                DefinesUnsafeCustomRules = false;

                // Note: multiple threads may try to access the value at the same time
                // We rely on the thread-safety guarantees given by Lazy<T> to prevent race conitions.
                // If you're thinking about replacing this, then you must be careful to keep this safe.
                rules = Exts.Lazy(() =>
                {
                    if (generator == null)
                        return Ruleset.LoadDefaultsForTileSet(modData, TileSet);

                    try
                    {
                        var ret = generator();
                        DefinesUnsafeCustomRules = ret.Second;
                        return ret.First;
                    }
                    catch (Exception e)
                    {
                        Log.Write("debug", "Failed to load rules for `{0}` with error :{1}", Title, e.Message);
                        InvalidCustomRules = true;
                        return Ruleset.LoadDefaultsForTileSet(modData, TileSet);
                    }
                    finally
                    {
                        RulesLoaded = true;
                    }
                });
            }
MapPreview.InnerData