public void PluginSelected() { RSImage image = new RSImage(Cache, Node, Data, (int)((NumericUpDown)ToolControls[1]).Value); ((PictureBox)Controls[0]).Image = image.GenerateBitmap(); if (((PictureBox)Controls[0]).Image == null) { Controls[0].Visible = false; Controls[1].Visible = true; FileExtensions = ""; } else { Controls[0].Visible = true; Controls[1].Visible = false; FileExtensions = "PNG Image (*.png)|*.png"; } }
public bool OnImport(string filename) { try { Exception e = null; RSImage new_image = new RSImage(filename, out e); if (e != null) throw e; new_image.Write(Cache, Node, Data); Data = Cache.SubArchives[Node.SubArchive].ExtractFile(Node.FileIndex); ((PictureBox)Controls[0]).Image = new_image.GenerateBitmap(); return true; } catch (Exception ex) { MessageBox.Show("Error importing image.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error Importing Image", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }