mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 10:47:02 -07:00
Code reuse and cleanup.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2126 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
abe79e65e9
commit
448f82f6c3
16 changed files with 119 additions and 107 deletions
|
@ -208,14 +208,14 @@ namespace Confluence {
|
|||
}
|
||||
}
|
||||
|
||||
public void addAttachment(long pageId, string mime, string comment, string filename, byte[] buffer) {
|
||||
public void addAttachment(long pageId, string mime, string comment, string filename, IBinaryContainer image) {
|
||||
checkCredentials();
|
||||
RemoteAttachment attachment = new RemoteAttachment();
|
||||
// Comment is ignored, see: http://jira.atlassian.com/browse/CONF-9395
|
||||
attachment.comment = comment;
|
||||
attachment.fileName = filename;
|
||||
attachment.contentType = mime;
|
||||
confluence.addAttachment(credentials, pageId, attachment, buffer);
|
||||
confluence.addAttachment(credentials, pageId, attachment, image.ToByteArray());
|
||||
}
|
||||
|
||||
public Page getPage(string spaceKey, string pageTitle) {
|
||||
|
|
|
@ -30,6 +30,7 @@ using Confluence;
|
|||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Core;
|
||||
using Greenshot.IniFile;
|
||||
using GreenshotPlugin.Controls;
|
||||
|
||||
namespace GreenshotConfluencePlugin {
|
||||
/// <summary>
|
||||
|
@ -158,15 +159,13 @@ namespace GreenshotConfluencePlugin {
|
|||
|
||||
private bool upload(Image image, Page page, string filename, out string errorMessage) {
|
||||
OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
|
||||
byte[] buffer;
|
||||
using (MemoryStream stream = new MemoryStream()) {
|
||||
ImageOutput.SaveToStream(image, stream, outputSettings);
|
||||
// COPY buffer to array
|
||||
buffer = stream.ToArray();
|
||||
}
|
||||
errorMessage = null;
|
||||
try {
|
||||
ConfluencePlugin.ConfluenceConnector.addAttachment(page.id, "image/" + config.UploadFormat.ToString().ToLower(), null, filename, buffer);
|
||||
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));
|
||||
}
|
||||
);
|
||||
LOG.Debug("Uploaded to Confluence.");
|
||||
if (config.CopyWikiMarkupForImageToClipboard) {
|
||||
int retryCount = 2;
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace GreenshotConfluencePlugin {
|
|||
CANCEL,
|
||||
upload_menu_item,
|
||||
upload_success,
|
||||
upload_failure
|
||||
upload_failure,
|
||||
communication_wait
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,5 +70,8 @@
|
|||
<resource name="loading">
|
||||
Confluence Daten werden geladen, bitte warten!
|
||||
</resource>
|
||||
<resource name="communication_wait">
|
||||
Übermittle Daten zu Confluence. Bitte warten...
|
||||
</resource>
|
||||
</resources>
|
||||
</language>
|
|
@ -73,5 +73,8 @@
|
|||
<resource name="include_person_spaces">
|
||||
Include personal spaces in search and browsing
|
||||
</resource>
|
||||
<resource name="communication_wait">
|
||||
Transferring data to Confluence, please wait...
|
||||
</resource>
|
||||
</resources>
|
||||
</language>
|
|
@ -70,5 +70,8 @@
|
|||
<resource name="loading">
|
||||
Confluence daten worden geladen, wachten A.U.B.
|
||||
</resource>
|
||||
<resource name="communication_wait">
|
||||
Gegevensoverdracht naar Confluence, wachten A.U.B...
|
||||
</resource>
|
||||
</resources>
|
||||
</language>
|
Loading…
Add table
Add a link
Reference in a new issue