<commit_before>// Copyright (c) 2007-2018 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System.Reflection;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using OpenTK;

namespace osu.Framework.Testing.Drawables.Sections
{
    public class ToolbarAssemblySection : ToolbarSection
    {
        private AssemblyDropdown assemblyDropdown;

        public ToolbarAssemblySection()
        {
            AutoSizeAxes = Axes.X;
            Masking = false;
        }

        [BackgroundDependencyLoader]
        private void load(TestBrowser browser)
        {
            BasicCheckbox runAllStepsCheckbox;

            InternalChild = new FillFlowContainer
            {
                Spacing = new Vector2(5),
                Direction = FillDirection.Horizontal,
                RelativeSizeAxes = Axes.Y,
                AutoSizeAxes = Axes.X,
                Children = new Drawable[]
                {
                    new SpriteText
                    {
                        Padding = new MarginPadding(5),
                        Text = "Assembly:"
                    },
                    assemblyDropdown = new AssemblyDropdown
                    {
                        Width = 250,
                    },
                    runAllStepsCheckbox = new BasicCheckbox
                    {
                        LabelText = "Run all steps",
                        LabelPadding = new MarginPadding { Left = 5, Right = 10 },
                        AutoSizeAxes = Axes.Y,
                        Width = 140,
                        Anchor = Anchor.CentreLeft,
                        Origin = Anchor.CentreLeft,
                    },
                }
            };

            assemblyDropdown.Current.BindTo(browser.Assembly);
            runAllStepsCheckbox.Current.BindTo(browser.RunAllSteps);
        }

        public void AddAssembly(string name, Assembly assembly) => assemblyDropdown.AddAssembly(name, assembly);

        private class AssemblyDropdown : BasicDropdown<Assembly>
        {
            public void AddAssembly(string name, Assembly assembly)
            {
                if (assembly == null) return;

                foreach (var item in MenuItems)
                {
                    if (item.Text.Value.Contains("dynamic"))
                        RemoveDropdownItem(item.Value);
                }

                AddDropdownItem(name, assembly);
            }
        }
    }
}<commit_msg>Fix dynamic compilation failing half of the time<commit_after>// Copyright (c) 2007-2018 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System.Linq;
using System.Reflection;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using OpenTK;

namespace osu.Framework.Testing.Drawables.Sections
{
    public class ToolbarAssemblySection : ToolbarSection
    {
        private AssemblyDropdown assemblyDropdown;

        public ToolbarAssemblySection()
        {
            AutoSizeAxes = Axes.X;
            Masking = false;
        }

        [BackgroundDependencyLoader]
        private void load(TestBrowser browser)
        {
            BasicCheckbox runAllStepsCheckbox;

            InternalChild = new FillFlowContainer
            {
                Spacing = new Vector2(5),
                Direction = FillDirection.Horizontal,
                RelativeSizeAxes = Axes.Y,
                AutoSizeAxes = Axes.X,
                Children = new Drawable[]
                {
                    new SpriteText
                    {
                        Padding = new MarginPadding(5),
                        Text = "Assembly:"
                    },
                    assemblyDropdown = new AssemblyDropdown
                    {
                        Width = 250,
                    },
                    runAllStepsCheckbox = new BasicCheckbox
                    {
                        LabelText = "Run all steps",
                        LabelPadding = new MarginPadding { Left = 5, Right = 10 },
                        AutoSizeAxes = Axes.Y,
                        Width = 140,
                        Anchor = Anchor.CentreLeft,
                        Origin = Anchor.CentreLeft,
                    },
                }
            };

            assemblyDropdown.Current.BindTo(browser.Assembly);
            runAllStepsCheckbox.Current.BindTo(browser.RunAllSteps);
        }

        public void AddAssembly(string name, Assembly assembly) => assemblyDropdown.AddAssembly(name, assembly);

        private class AssemblyDropdown : BasicDropdown<Assembly>
        {
            public void AddAssembly(string name, Assembly assembly)
            {
                if (assembly == null) return;

                foreach (var item in MenuItems.ToArray())
                {
                    if (item.Text.Value.Contains("dynamic"))
                        RemoveDropdownItem(item.Value);
                }

                AddDropdownItem(name, assembly);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.0734641006661732, 'fraction_numerical': 0.007401924500370096, 'mean_word_length': 1.4022222222222223, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4823889', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1242, 'n_words': 275}