private void btnLogoFileNameBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Images (*.png, *.bmp, *.tif, *.tiff)|*.png;*.bmp;*.tif;*.tiff";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string error;

                if (!FontCoder.CheckFile(openFileDialog.FileName, FontCoder.FontWidthKedei, FontCoder.FontHeightKedei, out error))
                {
                    ShowErrorMessageBox(error);
                }
                else
                {
                    txtLogoFileName.Text = openFileDialog.FileName;
                }
            }
        }
        public static bool ChangeLogo(string logoFileName, byte[] firmware, Firmware detectedFirmware, out string error)
        {
            error = string.Empty;

            FontCoder logo = new FontCoder(FontCoder.FontWidthKedei, FontCoder.FontHeightKedei);

            if (!logo.LoadImage(logoFileName))
            {
                error = $"Error! Cannot load logo from \"{logoFileName}\".";
                return(false);
            }

            byte[] logoBytes = logo.Encode();

            if (logoBytes.Length > detectedFirmware.MaxLogoLength)
            {
                error = "Error! Encoded logo is too long and would overwrite other firmware parts.";
                return(false);
            }

            Array.Copy(logoBytes, 0, firmware, detectedFirmware.LogoOffset, logoBytes.Length);

            return(true);
        }