Refactoring which replaces the Image in the ImageOutput for an ISurface, this makes it possible to save the Surface to any possible file format and even make it possible to pass some additional information in the OutputSettings. (Except reducing the colors, there are no other settings yet)

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2376 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-11 14:36:20 +00:00
commit 5541e2e1c7
27 changed files with 191 additions and 290 deletions

View file

@ -136,33 +136,31 @@ namespace GreenshotConfluencePlugin {
}
}
if (selectedPage != null) {
using (Image image = surface.GetImageForExport()) {
string errorMessage;
bool uploaded = upload(image, selectedPage, filename, out errorMessage);
if (uploaded) {
if (openPage) {
try {
Process.Start(selectedPage.Url);
} catch { }
}
exportInformation.ExportMade = true;
exportInformation.Uri = selectedPage.Url;
} else {
exportInformation.ErrorMessage = errorMessage;
string errorMessage;
bool uploaded = upload(surface, selectedPage, filename, out errorMessage);
if (uploaded) {
if (openPage) {
try {
Process.Start(selectedPage.Url);
} catch { }
}
exportInformation.ExportMade = true;
exportInformation.Uri = selectedPage.Url;
} else {
exportInformation.ErrorMessage = errorMessage;
}
}
ProcessExport(exportInformation, surface);
return exportInformation;
}
private bool upload(Image image, Page page, string filename, out string errorMessage) {
private bool upload(ISurface surfaceToUpload, Page page, string filename, out string errorMessage) {
OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
errorMessage = null;
try {
new PleaseWaitForm().ShowAndWait(Description, Language.GetString("confluence", LangKey.communication_wait),
delegate() {
ConfluencePlugin.ConfluenceConnector.addAttachment(page.id, "image/" + config.UploadFormat.ToString().ToLower(), null, filename, new ImageContainer(image, outputSettings, filename));
ConfluencePlugin.ConfluenceConnector.addAttachment(page.id, "image/" + config.UploadFormat.ToString().ToLower(), null, filename, new SurfaceContainer(surfaceToUpload, outputSettings, filename));
}
);
LOG.Debug("Uploaded to Confluence.");