/// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        public static void InsertBitmap()
        {
            using (WriteToROM writeToROM = new WriteToROM("PNG files|*.png|Bitmap files|*.bmp|GIF files|*.gif",
                true, true, false, imageForm.Offset, paletteForm.PaletteOffset, 0))
            {
                if (writeToROM.ShowDialog() == DialogResult.Cancel)
                    return;

                WriteToROMDialogResult res = writeToROM.getResult();
                using (Bitmap bitmap = new Bitmap(res.file))
                {
                    Color[] palette = GetPalette(bitmap);
                    using (Palette_editor palEd = new Palette_editor(palette, 16, 16))
                    {
                        if (palEd.ShowDialog() == DialogResult.OK)
                        {
                            palette = palEd.getPalette();
                        }
                    }
                    if (paletteForm.CompressedPalette)
                    {
                        var oldPalette = colorForm.Palette;
                        if (palette.Length < oldPalette.Length)
                        {
                            for (int i = 0; i < palette.Length; i++)
                            {
                                oldPalette[i] = palette[i];
                            }
                            palette = oldPalette;
                        }
                    }

                    if (paletteForm.GraphicsMode == GraphicsMode.Tile4bit ||
                        paletteForm.GraphicsMode == GraphicsMode.Tile8bit)
                    {
                        if ((bitmap.Size.Width & 0x3) != 0 || (bitmap.Size.Height & 0x3) != 0)
                        {
                            MessageBox.Show("Size of the bitmap must be muliple of 8x8");
                            return;
                        }
                    }

                    bool insertedGraphics = InsertRawData(res.infos[0],
                        GBAGraphics.ToGBARaw(bitmap, palette, paletteForm.GraphicsMode),
                        rawGraphics,
                        imageForm.Offset,
                        imageForm.CompressedGraphics);

                    bool insertPalette = InsertRawData(res.infos[1],
                        GBAPalette.toRawGBAPalette(palette),
                        rawPalette,
                        paletteForm.PaletteOffset,
                        paletteForm.CompressedPalette);

                    UpdateRanges();
                    if (insertedGraphics)
                    {
                        if (imageForm.Offset != res.infos[0].offset)
                            imageForm.Offset = res.infos[0].offset;
                    }
                    if (insertPalette)
                    {
                        if (paletteForm.PaletteOffset != res.infos[1].offset)
                            paletteForm.PaletteOffset = res.infos[1].offset;
                    }

                    //TSA insertion goes here
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        public static void InsertRawPalette()
        {
            using (WriteToROM writeToROM = new WriteToROM("GBA files|*.gba|Bibary files|*.bin|All files|*",
                false, true, false, 0, paletteForm.PaletteOffset, 0))
            {
                if (writeToROM.ShowDialog() == DialogResult.OK)
                    return;

                WriteToROMDialogResult res = writeToROM.getResult();

                byte[] newdata = File.ReadAllBytes(res.file);

                if (InsertRawData(res.infos[1],
                    newdata,
                    rawPalette,
                    paletteForm.PaletteOffset,
                    paletteForm.CompressedPalette))
                {
                    if (paletteForm.PaletteOffset != res.infos[1].offset)
                        paletteForm.PaletteOffset = res.infos[1].offset;
                }
                //do importing

            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        public static void InsertRawTSA()
        {
            using (WriteToROM writeToROM = new WriteToROM("GBA files|*.gba|Bibary files|*.bin|All files|*",
                false, false, true, 0, 0, tileForm.TSAOffset))
            {
                if (writeToROM.ShowDialog() == DialogResult.OK)
                    return;

                WriteToROMDialogResult res = writeToROM.getResult();

                byte[] newdata = File.ReadAllBytes(res.file);

                if (InsertRawData(res.infos[2],
                    newdata,
                    rawGraphics,
                    tileForm.TSAOffset,
                    tileForm.CompressedTSA))
                {
                    if (tileForm.TSAOffset != res.infos[2].offset)
                        tileForm.TSAOffset = res.infos[2].offset;
                }
                //do importing

            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        public static void InsertRawGraphics()
        {
            using (WriteToROM writeToROM = new WriteToROM("GBA files|*.gba|Bibary files|*.bin|All files|*",
                true, false, false, imageForm.Offset, 0, 0))
            {
                if (writeToROM.ShowDialog() == DialogResult.Cancel)
                    return;

                WriteToROMDialogResult res = writeToROM.getResult();

                byte[] newdata = File.ReadAllBytes(res.file);

                if (InsertRawData(res.infos[0],
                    newdata,
                    rawGraphics,
                    imageForm.Offset,
                    imageForm.CompressedGraphics))
                {
                    if (imageForm.Offset != res.infos[0].offset)
                        imageForm.Offset = res.infos[0].offset;
                }

            }
            //InsertRawData(this.rawGraphics, path);
        }