mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Picasa and Paste2 using UploaderService
This commit is contained in:
parent
bb3ff35a34
commit
73c4f7822e
3 changed files with 34 additions and 9 deletions
|
@ -26,6 +26,7 @@ You should have received a copy of the GNU General Public License
|
|||
using Newtonsoft.Json;
|
||||
using ShareX.HelpersLib;
|
||||
using ShareX.UploadersLib.HelperClasses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
|
@ -33,6 +34,24 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
namespace ShareX.UploadersLib.ImageUploaders
|
||||
{
|
||||
public class PicasaImageUploaderService : ImageUploaderService
|
||||
{
|
||||
public override ImageDestination EnumValue { get; } = ImageDestination.Picasa;
|
||||
|
||||
public override bool CheckConfig(UploadersConfig uploadersConfig)
|
||||
{
|
||||
return OAuth2Info.CheckOAuth(uploadersConfig.PicasaOAuth2Info);
|
||||
}
|
||||
|
||||
public override ImageUploader CreateUploader(UploadersConfig uploadersConfig)
|
||||
{
|
||||
return new Picasa(uploadersConfig.PicasaOAuth2Info)
|
||||
{
|
||||
AlbumID = uploadersConfig.PicasaAlbumID
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class Picasa : ImageUploader, IOAuth2
|
||||
{
|
||||
public OAuth2Info AuthInfo { get; set; }
|
||||
|
|
|
@ -23,10 +23,25 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ShareX.UploadersLib.TextUploaders
|
||||
{
|
||||
public class Paste2TextUploaderService : TextUploaderService
|
||||
{
|
||||
public override TextDestination EnumValue { get; } = TextDestination.Paste2;
|
||||
|
||||
public override bool CheckConfig(UploadersConfig uploadersConfig) => true;
|
||||
|
||||
public override TextUploader CreateUploader(UploadersConfig uploadersConfig)
|
||||
{
|
||||
Paste2Settings settings = new Paste2Settings();
|
||||
settings.TextFormat = uploadersConfig.TextFormat;
|
||||
return new Paste2(settings);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class Paste2 : TextUploader
|
||||
{
|
||||
private const string APIURL = "http://paste2.org/new-paste";
|
||||
|
|
|
@ -832,12 +832,6 @@ public UploadResult UploadImage(Stream stream, string fileName)
|
|||
case ImageDestination.Photobucket:
|
||||
imageUploader = new Photobucket(Program.UploadersConfig.PhotobucketOAuthInfo, Program.UploadersConfig.PhotobucketAccountInfo);
|
||||
break;
|
||||
case ImageDestination.Picasa:
|
||||
imageUploader = new Picasa(Program.UploadersConfig.PicasaOAuth2Info)
|
||||
{
|
||||
AlbumID = Program.UploadersConfig.PicasaAlbumID
|
||||
};
|
||||
break;
|
||||
case ImageDestination.Twitter:
|
||||
OAuthInfo twitterOAuth = Program.UploadersConfig.TwitterOAuthInfoList.ReturnIfValidIndex(Program.UploadersConfig.TwitterSelectedAccount);
|
||||
imageUploader = new Twitter(twitterOAuth)
|
||||
|
@ -907,9 +901,6 @@ public UploadResult UploadText(Stream stream, string fileName)
|
|||
{
|
||||
switch (Info.TaskSettings.TextDestination)
|
||||
{
|
||||
case TextDestination.Paste2:
|
||||
textUploader = new Paste2(new Paste2Settings { TextFormat = Program.UploadersConfig.TextFormat });
|
||||
break;
|
||||
case TextDestination.Slexy:
|
||||
textUploader = new Slexy(new SlexySettings { TextFormat = Program.UploadersConfig.TextFormat });
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue