private void set_output_quality_Click(object sender, EventArgs e) { var box = new setjpgquality(output_quality); box.ShowDialog(); output_quality = box.value; }
private void set_output_quality_Click(object sender, EventArgs e) { var box = new setjpgquality(output_quality); box.ShowDialog(); output_quality = box.value; include_exif = box.includes_exif; color_profile = box.color_profile; }
private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e) { var box2 = new Processing(); try { var box = new SaveFileDialog(); box.Title = "Save"; box.Filter = "JPEG(.jpg)|*.jpg"; box.ShowDialog(); if (box.FileName == "") { return; } var sq = new setjpgquality(); sq.ShowDialog(); Thread T; T = new Thread(new ThreadStart(new Action(() => { box2.ShowDialog(); }))); T.IsBackground = true; T.Start(); try { invoke_dll.invoke_heif_to_jpg(heicfile, sq.value, "temp_bitstream.hevc").Save(box.FileName, ImageFormat.Jpeg); } catch (Exception) { MessageBox.Show("Can not save to " + box.FileName); return; } box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); MessageBox.Show("Successfully saved to " + box.FileName); return; } catch (Exception ex) { box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); MessageBox.Show(ex.Message); return; } }
private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e) { var box2 = new Processing(); try { var box = new SaveFileDialog(); box.Title = "Save"; box.Filter = "JPEG(.jpg)|*.jpg"; box.ShowDialog(); if (box.FileName == "") { return; } var sq = new setjpgquality(); sq.ShowDialog(); Thread T; T = new Thread(new ThreadStart(new Action(() => { box2.ShowDialog(); }))); T.IsBackground = true; T.Start(); try { int copysize = 0; byte[] write_this; if (!sq.includes_exif) { write_this = invoke_dll.invoke_heif2jpg(heicfile, sq.value, "temp_bitstream.hevc", ref copysize, false); } else { write_this = invoke_dll.invoke_heif2jpg(heicfile, sq.value, "temp_bitstream.hevc", ref copysize, true); } FileStream fs = new FileStream(box.FileName, FileMode.Create); BinaryWriter writer = new BinaryWriter(fs); try { writer.Write(write_this, 0, copysize); writer.Close(); fs.Close(); } catch (Exception ex) { try { writer.Close(); fs.Close(); } catch (Exception) { } throw ex; } } catch (Exception) { box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); var errorbox = new Error(); errorbox.maintext.Text = "Can not save to " + box.FileName; errorbox.linklabel.Text = "Online Support"; errorbox.link = "https://liuziangexit.com/HEIF-Utility/Help/No2.html"; errorbox.ShowDialog(); return; } box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); MessageBox.Show("Successfully saved to " + box.FileName); return; } catch (Exception) { box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); MessageBox.Show("An unknown error occurred."); return; } }
private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e) { var box2 = new Processing(); try { var box = new SaveFileDialog(); box.Title = "保存"; box.Filter = "JPEG(.jpg)|*.jpg"; box.FileName = Batch_Conversion.make_output_filename(filename); if (box.ShowDialog() != DialogResult.OK) { return; } if (box.FileName == "") { return; } var sq = new setjpgquality(); sq.ShowDialog(); Thread T; T = new Thread(new ThreadStart(new Action(() => { box2.ShowDialog(); }))); T.IsBackground = true; T.Start(); while (!box2.IsHandleCreated) { Thread.Sleep(100); } try { int copysize = 0; byte[] write_this; write_this = invoke_dll.invoke_heif2jpg(heicfile, sq.value, "tmp/temp_bitstream.hevc", ref copysize, sq.includes_exif, sq.color_profile); FileStream fs = new FileStream(box.FileName, FileMode.Create); BinaryWriter writer = new BinaryWriter(fs); try { writer.Write(write_this, 0, copysize); writer.Close(); fs.Close(); } catch (Exception ex) { try { writer.Close(); fs.Close(); } catch (Exception) { } throw ex; } } catch (Exception) { box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); var errorbox = new Error(); errorbox.maintext.Text = "无法保存到 " + box.FileName; errorbox.linklabel.Text = "转到在线帮助"; errorbox.link = "https://liuziangexit.com/HEIF-Utility/Help/No2.html"; errorbox.ShowDialog(); return; } box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); MessageBox.Show("成功保存到 " + box.FileName); return; } catch (Exception) { box2.Invoke(new Action(() => { box2.Close(); })); this.Focus(); MessageBox.Show("发生未知错误。"); return; } }