Exemplo n.º 1
0
        private void mnuExport_Click(object sender, EventArgs e)
        {
            string filter = null, title = null;

            switch (this.OutMode)
            {
            case DumpTypes.Gfx:
                title  = "Save image as...";
                filter = "PNG|*.png|GIF|*.gif|BMP|*.bmp|JPEG|*.jpg";
                break;

            case DumpTypes.Raw:
            case DumpTypes.Text:
                title  = "Save text as...";
                filter = "Text file|*.txt";
                break;

            default:
                Program.Alert("current unsupported");
                break;
            }

            var savefile = ChooseFile.Save(title, this.Image.SoftwareTitle + " - " + this.CurrentChunk.Info.Addr.StartOffset + "-" + this.CurrentChunk.Info.Addr.EndOffset, null, filter);

            if (savefile == null)
            {
                return;
            }
            if (this.OutMode == DumpTypes.Gfx)
            {
                switch (Path.GetExtension(savefile).ToLower())
                {
                case ".png":
                    this.dispOut.OutPic.Save(savefile, System.Drawing.Imaging.ImageFormat.Png);
                    break;

                case ".gif":
                    this.dispOut.OutPic.Save(savefile, System.Drawing.Imaging.ImageFormat.Gif);
                    break;

                case ".bmp":
                    this.dispOut.OutPic.Save(savefile, System.Drawing.Imaging.ImageFormat.Bmp);
                    break;

                case ".jpg":
                case ".jpeg":
                    this.dispOut.OutPic.Save(savefile, System.Drawing.Imaging.ImageFormat.Jpeg);
                    break;

                default:
                    Program.Alert("current unsupported");
                    break;
                }
            }
            else
            {
                File.WriteAllText(savefile, this.dispOut.OutText);
            }
        }
Exemplo n.º 2
0
        private void mnuExportRaw_Click(object sender, EventArgs e)
        {
            var savefile = ChooseFile.Save("Save data chunk as...", this.Image.SoftwareTitle + " - " + this.CurrentChunk.Info.Addr.StartOffset + "-" + this.CurrentChunk.Info.Addr.EndOffset, null, "All files|*.*");

            if (savefile == null)
            {
                return;
            }
            File.WriteAllBytes(savefile, this.CurrentChunk.Data);
        }