Extended the ExportCapture with ExportInformation as a result object, this allows us to better and more consistently return & handle information from the export. Also it should be easier to extend the functionality. TODO: Still need to cleanup some messages, some are no longer needed

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2034 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-14 15:04:37 +00:00
commit be797ecf8a
27 changed files with 379 additions and 172 deletions

View file

@ -50,9 +50,9 @@ namespace GreenshotOCR {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
OcrPlugin.DoOCR(surface); OcrPlugin.DoOCR(surface);
return true; return new ExportInformation(this.Designation, this.Description, true);
} }
} }
} }

View file

@ -68,19 +68,19 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
try { try {
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
ClipboardHelper.SetClipboardData(image); ClipboardHelper.SetClipboardData(image);
surface.Modified = false; exportInformation.ExportMade = true;
} }
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetString(LangKey.editor_storedtoclipboard));
return true;
} catch (Exception) { } catch (Exception) {
// TODO: Change to general logic in ProcessExport
surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetString(LangKey.editor_clipboardfailed)); surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetString(LangKey.editor_clipboardfailed));
} }
ProcessExport(exportInformation, surface);
return false; return exportInformation;
} }
} }
} }

View file

@ -90,7 +90,8 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
if (editor == null) { if (editor == null) {
// Make sure we collect the garbage before opening the screenshot // Make sure we collect the garbage before opening the screenshot
GC.Collect(); GC.Collect();
@ -105,22 +106,24 @@ namespace Greenshot.Destinations {
editorForm.Show(); editorForm.Show();
editorForm.Activate(); editorForm.Activate();
LOG.Debug("Finished opening Editor"); LOG.Debug("Finished opening Editor");
return true; exportInformation.ExportMade = true;
} catch (Exception e) { } catch (Exception e) {
LOG.Error(e); LOG.Error(e);
exportInformation.ErrorMessage = e.Message;
} }
} else { } else {
try { try {
using (Bitmap image = (Bitmap)surface.GetImageForExport()) { using (Bitmap image = (Bitmap)surface.GetImageForExport()) {
editor.Surface.AddBitmapContainer(image, 10, 10); editor.Surface.AddBitmapContainer(image, 10, 10);
} }
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); exportInformation.ExportMade = true;
return true;
} catch (Exception e) { } catch (Exception e) {
LOG.Error(e); LOG.Error(e);
exportInformation.ErrorMessage = e.Message;
} }
} }
return false; ProcessExport(exportInformation, surface);
return exportInformation;
} }
} }
} }

View file

@ -175,16 +175,15 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
if (!isOutlookUsed) { if (!isOutlookUsed) {
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
MapiMailMessage.SendImage(image, captureDetails); MapiMailMessage.SendImage(image, captureDetails);
surface.Modified = false; exportInformation.ExportMade = true;
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "Exported to " + mapiClient);
} }
return true; return exportInformation;
} } else {
// Outlook logic // Outlook logic
string tmpFile = captureDetails.Filename; string tmpFile = captureDetails.Filename;
if (tmpFile == null || surface.Modified) { if (tmpFile == null || surface.Modified) {
@ -209,6 +208,7 @@ namespace Greenshot.Destinations {
if (outlookInspectorCaption != null) { if (outlookInspectorCaption != null) {
OutlookEmailExporter.ExportToInspector(outlookInspectorCaption, tmpFile, attachmentName); OutlookEmailExporter.ExportToInspector(outlookInspectorCaption, tmpFile, attachmentName);
exportInformation.ExportMade = true;
} else { } else {
if (!manuallyInitiated) { if (!manuallyInitiated) {
Dictionary<string, OlObjectClass> inspectorCaptions = OutlookEmailExporter.RetrievePossibleTargets(conf.OutlookAllowExportInMeetings); Dictionary<string, OlObjectClass> inspectorCaptions = OutlookEmailExporter.RetrievePossibleTargets(conf.OutlookAllowExportInMeetings);
@ -219,17 +219,14 @@ namespace Greenshot.Destinations {
destinations.Add(new EmailDestination(inspectorCaption, inspectorCaptions[inspectorCaption])); destinations.Add(new EmailDestination(inspectorCaption, inspectorCaptions[inspectorCaption]));
} }
PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations); PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
return false;
} }
} }
OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, FilenameHelper.FillPattern(conf.EmailSubjectPattern, captureDetails, false), attachmentName, conf.EmailTo, conf.EmailCC, conf.EmailBCC); OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, FilenameHelper.FillPattern(conf.EmailSubjectPattern, captureDetails, false), attachmentName, conf.EmailTo, conf.EmailCC, conf.EmailBCC);
} }
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); }
surface.Modified = false;
// Don't know how to handle a cancel in the email
return true; return exportInformation;
} }
} }
} }

View file

@ -110,7 +110,8 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
string tmpFile = captureDetails.Filename; string tmpFile = captureDetails.Filename;
if (tmpFile == null || surface.Modified) { if (tmpFile == null || surface.Modified) {
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
@ -122,9 +123,9 @@ namespace Greenshot.Destinations {
} else { } else {
ExcelExporter.InsertIntoNewWorkbook(tmpFile); ExcelExporter.InsertIntoNewWorkbook(tmpFile);
} }
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); exportInformation.ExportMade = true;
surface.Modified = false; ProcessExport(exportInformation, surface);
return true; return exportInformation;
} }
} }
} }

View file

@ -69,7 +69,8 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
bool outputMade; bool outputMade;
bool overwrite; bool overwrite;
string fullPath; string fullPath;
@ -114,14 +115,12 @@ namespace Greenshot.Destinations {
} }
// Don't overwite filename if no output is made // Don't overwite filename if no output is made
if (outputMade) { if (outputMade) {
surface.LastSaveFullPath = fullPath; exportInformation.ExportMade = outputMade;
surface.Modified = false; exportInformation.Filepath = fullPath;
captureDetails.Filename = fullPath; captureDetails.Filename = fullPath;
surface.SendMessageEvent(this, SurfaceMessageTyp.FileSaved, Language.GetFormattedString(LangKey.editor_imagesaved, surface.LastSaveFullPath));
} else {
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "");
} }
return outputMade; ProcessExport(exportInformation, surface);
return exportInformation;
} }
} }
} }

View file

@ -69,19 +69,20 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
string savedTo = null; string savedTo = null;
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
// Bug #2918756 don't overwrite path if SaveWithDialog returns null! // Bug #2918756 don't overwrite path if SaveWithDialog returns null!
savedTo = ImageOutput.SaveWithDialog(image, captureDetails); savedTo = ImageOutput.SaveWithDialog(image, captureDetails);
if (savedTo != null) { if (savedTo != null) {
surface.Modified = false; exportInformation.ExportMade = true;
surface.LastSaveFullPath = savedTo; exportInformation.Filepath = savedTo;
captureDetails.Filename = savedTo; captureDetails.Filename = savedTo;
surface.SendMessageEvent(this, SurfaceMessageTyp.FileSaved, Language.GetFormattedString(LangKey.editor_imagesaved, surface.LastSaveFullPath));
} }
} }
return savedTo != null; ProcessExport(exportInformation, surface);
return exportInformation;
} }
} }
} }

View file

@ -110,17 +110,20 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
if (page != null) { if (page != null) {
try { try {
OneNoteExporter.ExportToPage((Bitmap)image, page); OneNoteExporter.ExportToPage((Bitmap)image, page);
exportInformation.ExportMade = true;
} catch (Exception ex) { } catch (Exception ex) {
exportInformation.ErrorMessage = ex.Message;
LOG.Error(ex); LOG.Error(ex);
} }
} }
} }
return true; return exportInformation;
} }
} }
} }

View file

@ -102,10 +102,9 @@ namespace Greenshot.Destinations {
menu.Hide(); menu.Hide();
// Export // Export
bool result = clickedDestination.ExportCapture(true, surface, captureDetails); ExportInformation exportInformation = clickedDestination.ExportCapture(true, surface, captureDetails);
LOG.InfoFormat("Destination was {0} and result {1}", clickedDestination.Designation, result); if (exportInformation != null && exportInformation.ExportMade) {
if (result == true) { LOG.InfoFormat("Export to {0} success, closing menu", exportInformation.DestinationDescription);
LOG.Info("Export success, closing menu");
// close menu if the destination wasn't the editor // close menu if the destination wasn't the editor
menu.Close(); menu.Close();
@ -115,7 +114,7 @@ namespace Greenshot.Destinations {
surface = null; surface = null;
} }
} else { } else {
LOG.Info("Export failed, showing menu again"); LOG.Info("Export cancelled or failed, showing menu again");
// This prevents the problem that the context menu shows in the task-bar // This prevents the problem that the context menu shows in the task-bar
ShowMenuAtCursor(menu); ShowMenuAtCursor(menu);
} }
@ -180,7 +179,8 @@ namespace Greenshot.Destinations {
/// <param name="surface">Surface to export</param> /// <param name="surface">Surface to export</param>
/// <param name="captureDetails">Details of the capture</param> /// <param name="captureDetails">Details of the capture</param>
/// <returns>true if export was made</returns> /// <returns>true if export was made</returns>
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
List<IDestination> destinations = new List<IDestination>(); List<IDestination> destinations = new List<IDestination>();
foreach(IDestination destination in DestinationHelper.GetAllDestinations()) { foreach(IDestination destination in DestinationHelper.GetAllDestinations()) {
if ("Picker".Equals(destination.Designation)) { if ("Picker".Equals(destination.Designation)) {
@ -193,7 +193,9 @@ namespace Greenshot.Destinations {
} }
ShowPickerMenu(true, surface, captureDetails, destinations); ShowPickerMenu(true, surface, captureDetails, destinations);
return true; exportInformation.ExportMade = true;
// No Processing! :)
return exportInformation;
} }
} }
} }

View file

@ -111,7 +111,8 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
string tmpFile = captureDetails.Filename; string tmpFile = captureDetails.Filename;
Size imageSize = Size.Empty; Size imageSize = Size.Empty;
if (tmpFile == null || surface.Modified) { if (tmpFile == null || surface.Modified) {
@ -122,6 +123,7 @@ namespace Greenshot.Destinations {
} }
if (presentationName != null) { if (presentationName != null) {
PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title); PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title);
exportInformation.ExportMade = true;
} else { } else {
if (!manuallyInitiated) { if (!manuallyInitiated) {
List<string> presentations = PowerpointExporter.GetPowerpointPresentations(); List<string> presentations = PowerpointExporter.GetPowerpointPresentations();
@ -132,14 +134,16 @@ namespace Greenshot.Destinations {
destinations.Add(new PowerpointDestination(presentation)); destinations.Add(new PowerpointDestination(presentation));
} }
PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations); PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
return false; exportInformation.ExportMade = true;
} }
} }
if (!exportInformation.ExportMade) {
PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title); PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
exportInformation.ExportMade = true;
} }
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); }
surface.Modified = false; ProcessExport(exportInformation, surface);
return true; return exportInformation;
} }
} }
} }

View file

@ -93,7 +93,8 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
PrinterSettings printerSettings = null; PrinterSettings printerSettings = null;
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
if (!string.IsNullOrEmpty(printerName)) { if (!string.IsNullOrEmpty(printerName)) {
@ -105,12 +106,15 @@ namespace Greenshot.Destinations {
printerSettings = new PrintHelper(image, captureDetails).PrintWithDialog(); printerSettings = new PrintHelper(image, captureDetails).PrintWithDialog();
} }
if (printerSettings != null) { if (printerSettings != null) {
surface.Modified = false; printerName = printerSettings.PrinterName;
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.editor_senttoprinter, printerSettings.PrinterName)); // Renew destination
exportInformation.DestinationDescription = this.Description;
exportInformation.ExportMade = true;
} }
} }
return printerSettings != null; ProcessExport(exportInformation, surface);
return exportInformation;
} }
} }
} }

View file

@ -111,7 +111,8 @@ namespace Greenshot.Destinations {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
string tmpFile = captureDetails.Filename; string tmpFile = captureDetails.Filename;
if (tmpFile == null || surface.Modified) { if (tmpFile == null || surface.Modified) {
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
@ -121,13 +122,15 @@ namespace Greenshot.Destinations {
if (documentCaption != null) { if (documentCaption != null) {
try { try {
WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile);
exportInformation.ExportMade = true;
} catch (Exception) { } catch (Exception) {
try { try {
WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile); WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile);
exportInformation.ExportMade = true;
} catch (Exception ex) { } catch (Exception ex) {
LOG.Error(ex); LOG.Error(ex);
// TODO: Change to general logic in ProcessExport
surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description)); surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description));
return false;
} }
} }
} else { } else {
@ -140,25 +143,24 @@ namespace Greenshot.Destinations {
destinations.Add(new WordDestination(document)); destinations.Add(new WordDestination(document));
} }
PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations); PickerDestination.ShowPickerMenu(false, surface, captureDetails, destinations);
return false;
} }
} }
try { try {
WordExporter.InsertIntoNewDocument(tmpFile); WordExporter.InsertIntoNewDocument(tmpFile);
exportInformation.ExportMade = true;
} catch(Exception) { } catch(Exception) {
try { try {
WordExporter.InsertIntoNewDocument(tmpFile); WordExporter.InsertIntoNewDocument(tmpFile);
exportInformation.ExportMade = true;
} catch (Exception ex) { } catch (Exception ex) {
LOG.Error(ex); LOG.Error(ex);
// TODO: Change to general logic in ProcessExport
surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description)); surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description));
return false;
} }
} }
} }
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description)); ProcessExport(exportInformation, surface);
surface.Modified = false; return exportInformation;
return true;
} }
} }
} }

View file

@ -302,7 +302,7 @@ namespace Greenshot {
string dateTime = DateTime.Now.ToLongTimeString(); string dateTime = DateTime.Now.ToLongTimeString();
// TODO: Fix that we only open files, like in the tooltip // TODO: Fix that we only open files, like in the tooltip
//if (eventArgs.MessageType == SurfaceMessageTyp.FileSaved || eventArgs.MessageType == SurfaceMessageTyp.UploadedUrl) { //if (eventArgs.MessageType == SurfaceMessageTyp.FileSaved || eventArgs.MessageType == SurfaceMessageTyp.UploadedUrl) {
if (eventArgs.MessageType == SurfaceMessageTyp.FileSaved || eventArgs.MessageType == SurfaceMessageTyp.UploadedUrl) { if (eventArgs.MessageType == SurfaceMessageTyp.FileSaved || eventArgs.MessageType == SurfaceMessageTyp.UploadedUri) {
updateStatusLabel(dateTime + " - " + eventArgs.Message, fileSavedStatusContextMenu); updateStatusLabel(dateTime + " - " + eventArgs.Message, fileSavedStatusContextMenu);
} else { } else {
updateStatusLabel(dateTime + " - " + eventArgs.Message); updateStatusLabel(dateTime + " - " + eventArgs.Message);
@ -1059,7 +1059,8 @@ namespace Greenshot {
clickedDestination = (IDestination)clickedMenuItem.Tag; clickedDestination = (IDestination)clickedMenuItem.Tag;
} }
if (clickedDestination != null) { if (clickedDestination != null) {
if (clickedDestination.ExportCapture(true, surface, surface.CaptureDetails)) { ExportInformation exportInformation = clickedDestination.ExportCapture(true, surface, surface.CaptureDetails);
if (exportInformation != null && exportInformation.ExportMade) {
surface.Modified = false; surface.Modified = false;
} }
} }

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}</ProjectGuid> <ProjectGuid>{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -17,8 +17,27 @@
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<ApplicationManifest>greenshot.manifest</ApplicationManifest> <ApplicationManifest>greenshot.manifest</ApplicationManifest>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType> <DebugType>Full</DebugType>
@ -31,7 +50,7 @@
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DebugSymbols>false</DebugSymbols> <DebugSymbols>false</DebugSymbols>
<DebugType>None</DebugType> <DebugType>None</DebugType>
@ -43,6 +62,29 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<FileAlignment>4096</FileAlignment>
<DebugType>Full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<DebugType>None</DebugType>
<PlatformTarget>x86</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net"> <Reference Include="log4net">
<HintPath>Lib\log4net.dll</HintPath> <HintPath>Lib\log4net.dll</HintPath>
@ -405,6 +447,23 @@
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj"> <ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj">
<Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project> <Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project>
@ -412,11 +471,11 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PreBuildEvent>"$(MSBuildProjectDirectory)\tools\TortoiseSVN\SubWCRev.exe" "$(MSBuildProjectDirectory)\." "$(MSBuildProjectDirectory)\AssemblyInfo.cs.template" "$(MSBuildProjectDirectory)\AssemblyInfo.cs" <PreBuildEvent>"$(MSBuildProjectDirectory)\tools\TortoiseSVN\SubWCRev.exe" "$(MSBuildProjectDirectory)\." "$(MSBuildProjectDirectory)\AssemblyInfo.cs.template" "$(MSBuildProjectDirectory)\AssemblyInfo.cs"
copy "$(ProjectDir)log4net.xml" "$(SolutionDir)bin\$(Configuration)\log4net.xml"</PreBuildEvent> copy "$(ProjectDir)log4net.xml" "$(SolutionDir)bin\$(Configuration)\log4net.xml"</PreBuildEvent>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PreBuildEvent>"$(MSBuildProjectDirectory)\tools\TortoiseSVN\SubWCRev.exe" "$(MSBuildProjectDirectory)\." "$(MSBuildProjectDirectory)\AssemblyInfo.cs.template" "$(MSBuildProjectDirectory)\AssemblyInfo.cs" <PreBuildEvent>"$(MSBuildProjectDirectory)\tools\TortoiseSVN\SubWCRev.exe" "$(MSBuildProjectDirectory)\." "$(MSBuildProjectDirectory)\AssemblyInfo.cs.template" "$(MSBuildProjectDirectory)\AssemblyInfo.cs"
copy "$(ProjectDir)log4net-debug.xml" "$(SolutionDir)bin\$(Configuration)\log4net.xml"</PreBuildEvent> copy "$(ProjectDir)log4net-debug.xml" "$(SolutionDir)bin\$(Configuration)\log4net.xml"</PreBuildEvent>
</PropertyGroup> </PropertyGroup>

View file

@ -497,7 +497,7 @@ namespace Greenshot.Helpers {
MainForm.instance.notifyIcon.ShowBalloonTip(10000, "Greenshot", eventArgs.Message, ToolTipIcon.Info); MainForm.instance.notifyIcon.ShowBalloonTip(10000, "Greenshot", eventArgs.Message, ToolTipIcon.Info);
break; break;
case SurfaceMessageTyp.FileSaved: case SurfaceMessageTyp.FileSaved:
case SurfaceMessageTyp.UploadedUrl: case SurfaceMessageTyp.UploadedUri:
EventHandler balloonTipClickedHandler = null; EventHandler balloonTipClickedHandler = null;
EventHandler balloonTipClosedHandler = null; EventHandler balloonTipClosedHandler = null;
balloonTipClosedHandler = delegate(object sender, EventArgs e) { balloonTipClosedHandler = delegate(object sender, EventArgs e) {
@ -570,8 +570,8 @@ namespace Greenshot.Helpers {
} }
LOG.InfoFormat("Calling destination {0}", destination.Description); LOG.InfoFormat("Calling destination {0}", destination.Description);
bool destinationOk = destination.ExportCapture(false, surface, captureDetails); ExportInformation exportInformation = destination.ExportCapture(false, surface, captureDetails);
if (Destinations.EditorDestination.DESIGNATION.Equals(destination.Designation) && destinationOk) { if (Destinations.EditorDestination.DESIGNATION.Equals(destination.Designation) && exportInformation.ExportMade) {
canDisposeSurface = false; canDisposeSurface = false;
} }
} }

View file

@ -128,18 +128,19 @@ namespace Greenshot.Helpers {
/// <param name="designation"></param> /// <param name="designation"></param>
/// <param name="surface"></param> /// <param name="surface"></param>
/// <param name="captureDetails"></param> /// <param name="captureDetails"></param>
public static void ExportCapture(bool manuallyInitiated, string designation, ISurface surface, ICaptureDetails captureDetails) { public static ExportInformation ExportCapture(bool manuallyInitiated, string designation, ISurface surface, ICaptureDetails captureDetails) {
if (RegisteredDestinations.ContainsKey(designation)) { IDestination destination = GetDestination(designation);
IDestination destination = RegisteredDestinations[designation]; if (destination != null && destination.isActive) {
if (destination.isActive) { ExportInformation exportInformation = destination.ExportCapture(manuallyInitiated, surface, captureDetails);
if (destination.ExportCapture(manuallyInitiated, surface, captureDetails)) { if (exportInformation != null && exportInformation.ExportMade) {
// Export worked, set the modified flag to false if the export wasn't to the editor or picker // Export worked, set the modified flag to false if the export wasn't to the editor or picker
if (!EditorDestination.DESIGNATION.Equals(designation) && !PickerDestination.DESIGNATION.Equals(designation)) { if (!EditorDestination.DESIGNATION.Equals(designation) && !PickerDestination.DESIGNATION.Equals(designation)) {
surface.Modified = false; surface.Modified = false;
} }
} }
return exportInformation;
} }
} return null;
} }
} }
} }

View file

@ -140,6 +140,17 @@ namespace Greenshot.Helpers {
get {return plugins;} get {return plugins;}
} }
public IDestination GetDestination(string designation) {
return DestinationHelper.GetDestination(designation);
}
public List<IDestination> GetAllDestinations() {
return DestinationHelper.GetAllDestinations();
}
public ExportInformation ExportCapture(bool manuallyInitiated, string designation, ISurface surface, ICaptureDetails captureDetails) {
return DestinationHelper.ExportCapture(manuallyInitiated, designation, surface, captureDetails);
}
/// <summary> /// <summary>
/// Make Capture with specified Handler /// Make Capture with specified Handler
/// </summary> /// </summary>

View file

@ -114,10 +114,11 @@ namespace GreenshotConfluencePlugin {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
// force password check to take place before the pages load // force password check to take place before the pages load
if (!ConfluencePlugin.ConfluenceConnector.isLoggedIn) { if (!ConfluencePlugin.ConfluenceConnector.isLoggedIn) {
return false; return exportInformation;
} }
Page selectedPage = page; Page selectedPage = page;
@ -132,8 +133,6 @@ namespace GreenshotConfluencePlugin {
openPage = false; openPage = false;
} }
filename = confluenceUpload.Filename; filename = confluenceUpload.Filename;
} else {
return false;
} }
} }
if (selectedPage != null) { if (selectedPage != null) {
@ -146,17 +145,15 @@ namespace GreenshotConfluencePlugin {
Process.Start(selectedPage.Url); Process.Start(selectedPage.Url);
} catch { } } catch { }
} }
surface.UploadURL = selectedPage.Url; exportInformation.ExportMade = true;
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", Description)); exportInformation.Uri = selectedPage.Url;
surface.Modified = false;
return true;
} else { } else {
surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetString("confluence", LangKey.upload_failure) + " " + errorMessage); exportInformation.ErrorMessage = errorMessage;
} }
} }
} }
ProcessExport(exportInformation, surface);
return false; return exportInformation;
} }
private bool upload(Image image, Page page, string filename, out string errorMessage) { private bool upload(Image image, Page page, string filename, out string errorMessage) {

View file

@ -66,7 +66,8 @@ namespace ExternalCommand {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
OutputSettings outputSettings = new OutputSettings(); OutputSettings outputSettings = new OutputSettings();
string fullPath = captureDetails.Filename; string fullPath = captureDetails.Filename;
@ -82,10 +83,11 @@ namespace ExternalCommand {
commandThread.Name = "Running " + presetCommand; commandThread.Name = "Running " + presetCommand;
commandThread.IsBackground = true; commandThread.IsBackground = true;
commandThread.Start(); commandThread.Start();
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString("exported_to", Description)); exportInformation.ExportMade = true;
surface.Modified = false; //exportInformation.Uri = "file://" + fullPath;
} }
return true; ProcessExport(exportInformation, surface);
return exportInformation;
} }
private void CallExternalCommand(string commando, string fullPath) { private void CallExternalCommand(string commando, string fullPath) {

View file

@ -62,17 +62,15 @@ namespace GreenshotImgurPlugin {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
string uploadURL = null; string uploadURL = null;
bool uploaded = plugin.Upload(captureDetails, image, out uploadURL); exportInformation.ExportMade = plugin.Upload(captureDetails, image, out uploadURL);
if (uploaded) { exportInformation.Uri = uploadURL;
surface.UploadURL = uploadURL;
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", Designation));
surface.Modified = false;
}
return uploaded;
} }
ProcessExport(exportInformation, surface);
return exportInformation;
} }
} }
} }

View file

@ -101,7 +101,8 @@ namespace GreenshotJiraPlugin {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
string filename = Path.GetFileName(jiraPlugin.Host.GetFilename(config.UploadFormat, captureDetails)); string filename = Path.GetFileName(jiraPlugin.Host.GetFilename(config.UploadFormat, captureDetails));
byte[] buffer; byte[] buffer;
OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors); OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
@ -121,10 +122,8 @@ namespace GreenshotJiraPlugin {
} }
); );
LOG.Debug("Uploaded to Jira."); LOG.Debug("Uploaded to Jira.");
surface.UploadURL = jiraPlugin.JiraConnector.getURL(jira.Key); exportInformation.ExportMade = true;
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", FormatUpload(jira))); exportInformation.Uri = surface.UploadURL;
surface.Modified = false;
return true;
} catch (Exception e) { } catch (Exception e) {
MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message);
} }
@ -150,17 +149,16 @@ namespace GreenshotJiraPlugin {
} }
); );
LOG.Debug("Uploaded to Jira."); LOG.Debug("Uploaded to Jira.");
surface.UploadURL = jiraPlugin.JiraConnector.getURL(jiraForm.getJiraIssue().Key); exportInformation.ExportMade = true;
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", FormatUpload(jiraForm.getJiraIssue()))); exportInformation.Uri = surface.UploadURL;
surface.Modified = false;
return true;
} catch(Exception e) { } catch(Exception e) {
MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message); MessageBox.Show(Language.GetString("jira", LangKey.upload_failure) + " " + e.Message);
} }
} }
} }
} }
return false; ProcessExport(exportInformation, surface);
return exportInformation;
} }
} }
} }

View file

@ -62,17 +62,18 @@ namespace GreenshotPhotobucketPlugin {
} }
} }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
string uploadURL = null; string uploadURL = null;
bool uploaded = plugin.Upload(captureDetails, image, out uploadURL); bool uploaded = plugin.Upload(captureDetails, image, out uploadURL);
if (uploaded) { if (uploaded) {
surface.UploadURL = uploadURL; exportInformation.ExportMade = true;
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", Designation)); exportInformation.Uri = uploadURL;
surface.Modified = false;
} }
return uploaded;
} }
ProcessExport(exportInformation, surface);
return exportInformation;
} }
} }
} }

View file

@ -68,17 +68,14 @@ namespace GreenshotPhotobucketPlugin {
config = IniConfig.GetIniSection<PhotobucketConfiguration>(); config = IniConfig.GetIniSection<PhotobucketConfiguration>();
resources = new ComponentResourceManager(typeof(PhotobucketPlugin)); resources = new ComponentResourceManager(typeof(PhotobucketPlugin));
ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Photobucket"); ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem("Photobucket " + Language.GetString("photobucket", LangKey.configure));
itemPlugInRoot.Image = (Image)resources.GetObject("Photobucket");
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(Language.GetString("photobucket", LangKey.configure));
itemPlugInConfig.Tag = host; itemPlugInConfig.Tag = host;
itemPlugInConfig.Click += delegate { itemPlugInConfig.Click += delegate {
config.ShowConfigDialog(); config.ShowConfigDialog();
}; };
itemPlugInRoot.DropDownItems.Add(itemPlugInConfig); itemPlugInConfig.Image = (Image)resources.GetObject("Photobucket");
PluginUtils.AddToContextMenu(host, itemPlugInRoot); PluginUtils.AddToContextMenu(host, itemPlugInConfig);
return true; return true;
} }

View file

@ -173,6 +173,12 @@ namespace GreenshotPlugin.Core {
} }
} }
public virtual bool isLinkable {
get {
return false;
}
}
public virtual bool isActive { public virtual bool isActive {
get { get {
if (configuration.ExcludeDestinations != null && configuration.ExcludeDestinations.Contains(Designation)) { if (configuration.ExcludeDestinations != null && configuration.ExcludeDestinations.Contains(Designation)) {
@ -182,7 +188,29 @@ namespace GreenshotPlugin.Core {
} }
} }
public abstract bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails); public abstract ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails);
/// <summary>
/// A small helper method to perform some default destination actions, like inform the surface of the export
/// </summary>
/// <param name="exportInformation"></param>
/// <param name="surface"></param>
public void ProcessExport(ExportInformation exportInformation, ISurface surface) {
if (exportInformation != null && exportInformation.ExportMade) {
if (!string.IsNullOrEmpty(exportInformation.Uri)) {
surface.UploadURL = exportInformation.Uri;
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUri, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription));
} else if (!string.IsNullOrEmpty(exportInformation.Filepath)) {
surface.LastSaveFullPath = exportInformation.Filepath;
surface.SendMessageEvent(this, SurfaceMessageTyp.FileSaved, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription));
} else {
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription));
}
surface.Modified = false;
} else if (exportInformation != null && !string.IsNullOrEmpty(exportInformation.ErrorMessage)) {
surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("exported_to_error", exportInformation.DestinationDescription) + " " + exportInformation.ErrorMessage);
}
}
public override string ToString() { public override string ToString() {
return Description; return Description;

View file

@ -37,7 +37,7 @@ namespace Greenshot.Plugin {
FileSaved, FileSaved,
Error, Error,
Info, Info,
UploadedUrl UploadedUri
} }
public class SurfaceMessageEventArgs : EventArgs { public class SurfaceMessageEventArgs : EventArgs {

View file

@ -24,6 +24,75 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace Greenshot.Plugin { namespace Greenshot.Plugin {
public class ExportInformation {
private string uri = null;
private string filepath = null;
private bool exportMade = false;
private string destinationDesignation = null;
private string destinationDescription = null;
private string errorMessage = null;
public ExportInformation(string destinationDesignation, string destinationDescription) {
this.destinationDesignation = destinationDesignation;
this.destinationDescription = destinationDescription;
}
public ExportInformation(string destinationDesignation, string destinationDescription, bool exportMade): this(destinationDesignation, destinationDescription) {
this.exportMade = exportMade;
}
public string DestinationDesignation {
get {
return destinationDesignation;
}
}
public string DestinationDescription {
get {
return destinationDescription;
}
set {
destinationDescription = value;
}
}
public bool ExportMade {
get {
return exportMade;
}
set {
exportMade = value;
}
}
public string Uri {
get {
return uri;
}
set {
uri = value;
}
}
public string ErrorMessage {
get {
return errorMessage;
}
set {
errorMessage = value;
}
}
public string Filepath {
get {
return filepath;
}
set {
filepath = value;
}
}
}
/// <summary> /// <summary>
/// Description of IDestination. /// Description of IDestination.
/// </summary> /// </summary>
@ -90,13 +159,20 @@ namespace Greenshot.Plugin {
get; get;
} }
/// <summary>
/// Returns true if this destination returns a link
/// </summary>
bool isLinkable {
get;
}
/// <summary> /// <summary>
/// If a capture is made, and the destination is enabled, this method is called. /// If a capture is made, and the destination is enabled, this method is called.
/// </summary> /// </summary>
/// <param name="manuallyInitiated">true if the user selected this destination from a GUI, false if it was called as part of a process</param> /// <param name="manuallyInitiated">true if the user selected this destination from a GUI, false if it was called as part of a process</param>
/// <param name="surface"></param> /// <param name="surface"></param>
/// <param name="captureDetails"></param> /// <param name="captureDetails"></param>
/// <returns>true if the destination has "exported" the capture</returns> /// <returns>DestinationExportInformation with information, like if the destination has "exported" the capture</returns>
bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails); ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails);
} }
} }

View file

@ -175,6 +175,28 @@ namespace Greenshot.Plugin {
get; get;
} }
/// <summary>
/// Get a destination by it's designation
/// </summary>
/// <param name="destination"></param>
/// <returns>IDestination</returns>
IDestination GetDestination(string designation);
/// <summary>
/// Get a list of all available destinations
/// </summary>
/// <returns>List<IDestination></returns>
List<IDestination> GetAllDestinations();
/// <summary>
/// Export a surface to the destination with has the supplied designation
/// </summary>
/// <param name="manuallyInitiated"></param>
/// <param name="designation"></param>
/// <param name="surface"></param>
/// <param name="captureDetails"></param>
ExportInformation ExportCapture(bool manuallyInitiated, string designation, ISurface surface, ICaptureDetails captureDetails);
/// <summary> /// <summary>
/// Make region capture with specified Handler /// Make region capture with specified Handler
/// </summary> /// </summary>