private void LoadLayoutNoInvalidate(string name)
        {
            IFormatter formatter = new BinaryFormatter();

            int TotalWidth = this.Width / ld.starsShown;

            string ext = Path.GetExtension(name);

            Stream stream          = new FileStream(name, FileMode.Open, FileAccess.Read, FileShare.Read);
            object layout          = formatter.Deserialize(stream);
            string layoutClassName = layout.GetType().Name;

            if (layoutClassName == "LayoutDescription")
            {
                ld = new LayoutDescriptionEx((LayoutDescription)layout);
            }
            else if (layoutClassName == "LayoutDescriptionEx")
            {
                ld = (LayoutDescriptionEx)layout;
            }
            else
            {
                MessageBox.Show("Failed to load layout, unknown extension", "Layour Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            ld.RecountStars();

            this.SafeInvoke((MethodInvoker) delegate { this.Width = TotalWidth * ld.starsShown; });

            if (ld.darkStar == null)
            {
                ld.GenerateDarkStar();
            }
            if (ld.redOutline == null)
            {
                ld.GenerateOutline();
            }
            if (ld.invertedStar == null)
            {
                ld.GenerateInvertedStar();
            }
            ld.Trim();
        }
        private void LoadLayoutNoInvalidate(string name, bool showFail)
        {
            int TotalWidth = this.Width / ld.starsShown;

            try
            {
                string ext = Path.GetExtension(name);
                if (ext == ".sml")
                {
                    Stream     stream          = new FileStream(name, FileMode.Open, FileAccess.Read, FileShare.Read);
                    IFormatter formatter       = new BinaryFormatter();
                    object     layout          = formatter.Deserialize(stream);
                    string     layoutClassName = layout.GetType().Name;

                    if (layoutClassName == "LayoutDescriptionEx")
                    {
                        ld = (LayoutDescriptionEx)layout;
                    }
                    else
                    {
                        MessageBox.Show("Failed to load layout, unknown extension", "Layour Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    var json = File.ReadAllText(name);
                    ld = JsonConvert.DeserializeObject <LayoutDescriptionEx>(json);
                }
            }
            catch (Exception e)
            {
                if (showFail)
                {
                    MessageBox.Show($"Failed to load the layout {name}!");
                }
                else
                {
                    throw e;
                }

                return;
            }

            ld.RecountStars();

            if (ld.darkStar == null)
            {
                ld.GenerateDarkStar();
            }
            if (ld.redOutline == null)
            {
                ld.GenerateOutline();
            }
            if (ld.invertedStar == null)
            {
                ld.GenerateInvertedStar();
            }
            ld.Trim();

            this.SafeInvoke((MethodInvoker) delegate { this.Width = TotalWidth * ld.starsShown; });
        }