// Token: 0x06000005 RID: 5 RVA: 0x0000247C File Offset: 0x0000067C
        private void button_Open_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Open";
            openFileDialog.Filter = "BTX (*.btx; *.btx0)|*.btx;*.btx0";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.button_Save.Enabled    = false;
                this.button_Export.Enabled  = false;
                this.button_Import.Enabled  = false;
                this.checkBox_Shiny.Enabled = false;
                this.checkBox_Shiny.Checked = false;
                this.BTXFile = File.ReadAllBytes(openFileDialog.FileName);
                this.bm      = BTX0.Read(this.BTXFile);
                if (this.bm != null)
                {
                    this.button_Save.Enabled   = true;
                    this.button_Export.Enabled = true;
                    this.button_Import.Enabled = true;
                    if (Program.PaletteSize == 64U && Program.PaletteCount == 2U)
                    {
                        this.checkBox_Shiny.Enabled = true;
                    }
                    this.pictureBox1.Width  = this.bm.Width;
                    this.pictureBox1.Height = this.bm.Height;
                    this.pictureBox1.Image  = this.bm;
                    return;
                }
                MessageBox.Show("This file is not supported.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
 // Token: 0x0600000C RID: 12 RVA: 0x000028BC File Offset: 0x00000ABC
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.button_Save.Enabled    = false;
     this.button_Export.Enabled  = false;
     this.button_Import.Enabled  = false;
     this.checkBox_Shiny.Enabled = false;
     this.checkBox_Shiny.Checked = false;
     this.BTXFile = File.ReadAllBytes(this.files[this.comboBox1.SelectedIndex]);
     this.bm      = BTX0.Read(this.BTXFile);
     if (this.bm != null)
     {
         this.button_Save.Enabled   = true;
         this.button_Export.Enabled = true;
         this.button_Import.Enabled = true;
         if (Program.PaletteSize == 64U && Program.PaletteCount == 2U)
         {
             this.checkBox_Shiny.Enabled = true;
         }
         this.pictureBox1.Width  = this.bm.Width;
         this.pictureBox1.Height = this.bm.Height;
         this.pictureBox1.Image  = this.bm;
         return;
     }
     MessageBox.Show("This file is not supported.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
 }
        // Token: 0x06000004 RID: 4 RVA: 0x0000246B File Offset: 0x0000066B
        public Form1(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("btx0topng extracts the overworld textures from a btx0 in hgss' a081 narc.\nUsage:  btx0topng [btx0 file] [png file]");
            }
            this.BTXFile = File.ReadAllBytes(args[0]);
            this.bm      = BTX0.Read(this.BTXFile);
            if (this.bm != null)
            {
                this.bm.Save(args[1]);

                if (Program.PaletteSize == 64U && Program.PaletteCount == 2U)                 // if there's a shiny palette.  on importing, the shiny image will only be used for the palette!
                {
                    String targetFile = args[1];
                    Program.PaletteIndex = 1U;

                    if (targetFile.Contains(".png"))
                    {
                        targetFile = targetFile.Substring(0, targetFile.Length - ".png".Length);
                    }

                    this.bm = BTX0.Read(this.BTXFile);
                    this.bm.Save(targetFile + "_shiny.png");
                }
            }
            else
            {
                Console.WriteLine("This file is not supported.");
            }
        }
 // Token: 0x06000009 RID: 9 RVA: 0x000027A8 File Offset: 0x000009A8
 private void checkBox_Shiny_CheckedChanged(object sender, EventArgs e)
 {
     if (this.checkBox_Shiny.Checked)
     {
         Program.PaletteIndex = 1U;
     }
     else
     {
         Program.PaletteIndex = 0U;
     }
     if (this.checkBox_Shiny.Enabled)
     {
         this.bm = BTX0.Read(this.BTXFile);
         this.pictureBox1.Image = this.bm;
     }
 }
        // Token: 0x06000008 RID: 8 RVA: 0x00002634 File Offset: 0x00000834
        private void button_Import_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Open";
            openFileDialog.Filter = "PNG (*.png)|*.png";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Bitmap bitmap = new Bitmap(openFileDialog.FileName);
                if (this.bm.Width == bitmap.Width && this.bm.Height == bitmap.Height)
                {
                    if (this.GetColorCount(bitmap) <= Program.ColorCount)
                    {
                        this.BTXFile           = BTX0.Write(this.BTXFile, bitmap);
                        this.bm                = BTX0.Read(this.BTXFile);
                        this.pictureBox1.Image = this.bm;
                        return;
                    }
                    MessageBox.Show(string.Concat(new object[]
                    {
                        "Too many colors!\nBTX: ",
                        Program.ColorCount,
                        "\nPNG: ",
                        this.GetColorCount(bitmap)
                    }), "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                else
                {
                    MessageBox.Show(string.Concat(new object[]
                    {
                        "Not the same size!\nBTX: ",
                        this.bm.Width,
                        "x",
                        this.bm.Height,
                        "\nPNG: ",
                        bitmap.Width,
                        "x",
                        bitmap.Height
                    }), "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
        // Token: 0x06000004 RID: 4 RVA: 0x0000246B File Offset: 0x0000066B
        public Form1(string[] args)
        {
            String pngFile;

            if (args.Length != 2)
            {
                Console.WriteLine("pngtobtx0 reimports png images into a template btx0 file.\nin this repository, it is used with the template btx0's in rawdata specifically.\nspecifically made for hgss' a081 narc and for usage with hgss-monexpansion.\nUsage:  pngtobtx0 [png file] [btx0 file]");
            }

            try
            {
                this.BTXFile = File.ReadAllBytes("rawdata\\a081_smallmon");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

                return;
            }

            this.bm = BTX0.Read(this.BTXFile);
            if (this.bm == null)
            {
                Console.WriteLine("target file specified is not a btx0 file");
            }

            if (Program.PaletteSize == 64U && Program.PaletteCount == 2U)             // handle shiny palette if one exists first
            {
                Program.PaletteIndex = 1U;
                pngFile = args[0];
                if (pngFile.Contains(".png"))
                {
                    pngFile = pngFile.Substring(0, pngFile.Length - ".png".Length);
                }

                Bitmap shinymap = new Bitmap(pngFile + "_shiny.png");

                if (pngFile.Contains("graphics\\overworlds\\"))
                {
                    pngFile = pngFile.Substring("graphics\\overworlds\\".Length, pngFile.Length - "graphics\\overworlds\\".Length);
                }

                if (shinymap.Width > 32)                 // if a big mon
                {
                    try
                    {
                        this.BTXFile = File.ReadAllBytes("rawdata\\a081_bigmon");
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);

                        return;
                    }

                    this.bm = BTX0.Read(this.BTXFile);
                }

                if (this.bm.Width == shinymap.Width && this.bm.Height == shinymap.Height)
                {
                    if (this.GetColorCount(shinymap) <= Program.ColorCount)
                    {
                        this.BTXFile = BTX0.Write(this.BTXFile, shinymap);

                        File.WriteAllBytes(args[1], this.BTXFile);
                    }
                    else
                    {
                        Console.WriteLine("shiny palette has too many colors");
                        return;
                    }
                }
                else
                {
                    Console.WriteLine("shiny png isn't the right width or height");
                    return;
                }
            }

            pngFile = args[0];
            if (pngFile.Contains(".png"))
            {
                pngFile = pngFile.Substring(0, pngFile.Length - ".png".Length);
            }

            Program.PaletteIndex = 0U;

            Bitmap bitmap = new Bitmap(pngFile + ".png");

            if (pngFile.Contains("graphics\\overworlds\\"))
            {
                pngFile = pngFile.Substring("graphics\\overworlds\\".Length, pngFile.Length - "graphics\\overworlds\\".Length);
            }

            if (bitmap.Width > 32)             // if a big mon
            {
                try
                {
                    this.BTXFile = File.ReadAllBytes("rawdata\\a081_bigmon");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);

                    return;
                }

                this.bm = BTX0.Read(this.BTXFile);
            }

            if (this.bm.Width == bitmap.Width && this.bm.Height == bitmap.Height)
            {
                if (this.GetColorCount(bitmap) <= Program.ColorCount)
                {
                    this.BTXFile = BTX0.Write(this.BTXFile, bitmap);

                    File.WriteAllBytes(args[1], this.BTXFile);
                }
                else
                {
                    Console.WriteLine("normal palette has too many colors");
                    return;
                }
            }
            else
            {
                Console.WriteLine("png file doesn't have the right width or height");
                return;
            }
        }