private void ePUBCoverExtrahierenToolStripMenuItem_Click(object sender, EventArgs e) { if (openEpub.ShowDialog() != DialogResult.OK) { return; } ZipFile zf = ZipFile.Read(openEpub.FileName); foreach (ZipEntry entry in zf) { if (entry.FileName.EndsWith("cover.jpg") || entry.FileName.EndsWith("hyousi.jpg")) { Stream zipStream = entry.OpenReader(); MemoryStream imageStream = new MemoryStream(); zipStream.CopyTo(imageStream); int imageLength = (int)imageStream.Position; zipStream.Close(); if (imageLength > MaxPictureSize) { Image image = Image.FromStream(imageStream); Data = JpegCompressor.CompressJpeg(image, MaxPictureSize); return; } Data = imageStream.ToArray(); return; } } }
private void LoadPlugins() { AzusaContext azusaContext = AzusaContext.GetInstance(); foreach (IImageAcquisitionPlugin plugin in azusaContext.ImageAcquisitionPlugins) { if (plugin.CanStart()) { ToolStripButton tsb = new ToolStripButton(plugin.Name); tsb.Click += delegate(object sender, EventArgs args) { Image result = plugin.Acquire(); if (result != null) { Data = JpegCompressor.CompressJpeg(result, MaxPictureSize); } else { MessageBox.Show("Das Plug-In hat kein Bild geliefert!"); } }; this.contextMenuStrip1.Items.Add(tsb); } } }
private void neuesBildScannenToolStripMenuItem_Click(object sender, EventArgs e) { Image image = ScanForm.ScanSomething(this.FindForm()); if (image != null) { Data = JpegCompressor.CompressJpeg(image, MaxPictureSize); } }