public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); string tmpFile = captureDetails.Filename; if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) { tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat()); } if (documentCaption != null) { try { WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); exportInformation.ExportMade = true; } catch (Exception) { try { WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); exportInformation.ExportMade = true; } catch (Exception ex) { LOG.Error(ex); // TODO: Change to general logic in ProcessExport surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description)); } } } else { if (!manuallyInitiated) { List <string> documents = WordExporter.GetWordDocuments(); if (documents != null && documents.Count > 0) { List <IDestination> destinations = new List <IDestination>(); destinations.Add(new WordDestination()); foreach (string document in documents) { destinations.Add(new WordDestination(document)); } // Return the ExportInformation from the picker without processing, as this indirectly comes from us self return(ShowPickerMenu(false, surface, captureDetails, destinations)); } } try { WordExporter.InsertIntoNewDocument(tmpFile, null, null); exportInformation.ExportMade = true; } catch (Exception) { // Retry once, just in case try { WordExporter.InsertIntoNewDocument(tmpFile, null, null); exportInformation.ExportMade = true; } catch (Exception ex) { LOG.Error(ex); // TODO: Change to general logic in ProcessExport surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description)); } } } ProcessExport(exportInformation, surface); return(exportInformation); }
public override IEnumerable <IDestination> DynamicDestinations() { foreach (string wordCaption in WordExporter.GetWordDocuments()) { yield return(new WordDestination(wordCaption)); } }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { string tmpFile = captureDetails.Filename; if (tmpFile == null || surface.Modified) { using (Image image = surface.GetImageForExport()) { tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors); } } if (documentCaption != null) { WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); } else { if (!manuallyInitiated) { List <string> documents = WordExporter.GetWordDocuments(); if (documents != null && documents.Count > 0) { List <IDestination> destinations = new List <IDestination>(); destinations.Add(new WordDestination()); foreach (string document in documents) { destinations.Add(new WordDestination(document)); } ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations); PickerDestination.ShowMenuAtCursor(menu); return(false); } } WordExporter.InsertIntoNewDocument(tmpFile); } surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); surface.Modified = false; return(true); }
public override IEnumerable <IDestination> DynamicDestinations() { return(WordExporter.GetWordDocuments().Select(wordCaption => new WordDestination(wordCaption, CoreConfiguration, GreenshotLanguage))); }
public override IEnumerable<IDestination> DynamicDestinations() { return WordExporter.GetWordDocuments().Select(wordCaption => new WordDestination(wordCaption)); }