Get uploader icon from its service

This commit is contained in:
Jaex 2016-06-27 20:20:55 +03:00
parent 40923d9364
commit f79bb6e375
52 changed files with 229 additions and 58 deletions

View file

@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib namespace ShareX.UploadersLib
@ -31,6 +32,10 @@ public interface IUploaderService
{ {
string ServiceName { get; } string ServiceName { get; }
Icon ServiceIcon { get; }
Image ServiceImage { get; }
bool CheckConfig(UploadersConfig config); bool CheckConfig(UploadersConfig config);
TabPage GetUploadersConfigTabPage(UploadersConfigForm form); TabPage GetUploadersConfigTabPage(UploadersConfigForm form);

View file

@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib; using ShareX.HelpersLib;
using System; using System;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib namespace ShareX.UploadersLib
@ -41,6 +42,10 @@ public string ServiceName
} }
} }
public virtual Icon ServiceIcon { get; }
public virtual Image ServiceImage { get; }
public abstract bool CheckConfig(UploadersConfig config); public abstract bool CheckConfig(UploadersConfig config);
public virtual TabPage GetUploadersConfigTabPage(UploadersConfigForm form) public virtual TabPage GetUploadersConfigTabPage(UploadersConfigForm form)

View file

@ -30,9 +30,11 @@ You should have received a copy of the GNU General Public License
using Amazon.S3; using Amazon.S3;
using Amazon.S3.Model; using Amazon.S3.Model;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
@ -44,6 +46,8 @@ public class AmazonS3FileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.AmazonS3; public override FileDestination EnumValue { get; } = FileDestination.AmazonS3;
public override Icon ServiceIcon => Resources.AmazonS3;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.AmazonS3Settings != null && !string.IsNullOrEmpty(config.AmazonS3Settings.AccessKeyID) && return config.AmazonS3Settings != null && !string.IsNullOrEmpty(config.AmazonS3Settings.AccessKeyID) &&

View file

@ -24,8 +24,10 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -35,6 +37,8 @@ public class BoxFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Box; public override FileDestination EnumValue { get; } = FileDestination.Box;
public override Icon ServiceIcon => Resources.Box;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return OAuth2Info.CheckOAuth(config.BoxOAuth2Info); return OAuth2Info.CheckOAuth(config.BoxOAuth2Info);

View file

@ -26,6 +26,7 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties; using ShareX.UploadersLib.Properties;
using System; using System;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -35,6 +36,8 @@ public class CustomFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.CustomFileUploader; public override FileDestination EnumValue { get; } = FileDestination.CustomFileUploader;
public override Image ServiceImage => Resources.globe_network;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.CustomUploadersList != null && config.CustomUploadersList.IsValidIndex(config.CustomFileUploaderSelected); return config.CustomUploadersList != null && config.CustomUploadersList.IsValidIndex(config.CustomFileUploaderSelected);

View file

@ -25,9 +25,11 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
@ -38,6 +40,8 @@ public class DropboxFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Dropbox; public override FileDestination EnumValue { get; } = FileDestination.Dropbox;
public override Icon ServiceIcon => Resources.Dropbox;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return OAuth2Info.CheckOAuth(config.DropboxOAuth2Info); return OAuth2Info.CheckOAuth(config.DropboxOAuth2Info);

View file

@ -23,6 +23,8 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.UploadersLib.Properties;
using System.Drawing;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Mail; using System.Net.Mail;
@ -34,6 +36,8 @@ public class EmailFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Email; public override FileDestination EnumValue { get; } = FileDestination.Email;
public override Image ServiceImage => Resources.mail;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.EmailSmtpServer) && config.EmailSmtpPort > 0 && !string.IsNullOrEmpty(config.EmailFrom) && !string.IsNullOrEmpty(config.EmailPassword); return !string.IsNullOrEmpty(config.EmailSmtpServer) && config.EmailSmtpPort > 0 && !string.IsNullOrEmpty(config.EmailFrom) && !string.IsNullOrEmpty(config.EmailPassword);

View file

@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
@ -41,6 +42,8 @@ public class FTPFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.FTP; public override FileDestination EnumValue { get; } = FileDestination.FTP;
public override Image ServiceImage => Resources.folder_network;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.FTPAccountList != null && config.FTPAccountList.IsValidIndex(config.FTPSelectedFile); return config.FTPAccountList != null && config.FTPAccountList.IsValidIndex(config.FTPSelectedFile);

View file

@ -24,7 +24,9 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -34,6 +36,8 @@ public class Ge_ttFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Ge_tt; public override FileDestination EnumValue { get; } = FileDestination.Ge_tt;
public override Icon ServiceIcon => Resources.Gett;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.Ge_ttLogin != null && !string.IsNullOrEmpty(config.Ge_ttLogin.AccessToken); return config.Ge_ttLogin != null && !string.IsNullOrEmpty(config.Ge_ttLogin.AccessToken);

View file

@ -24,9 +24,11 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Web; using System.Web;
using System.Windows.Forms; using System.Windows.Forms;
@ -37,6 +39,8 @@ public class GoogleDriveFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.GoogleDrive; public override FileDestination EnumValue { get; } = FileDestination.GoogleDrive;
public override Icon ServiceIcon => Resources.GoogleDrive;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return OAuth2Info.CheckOAuth(config.GoogleDriveOAuth2Info); return OAuth2Info.CheckOAuth(config.GoogleDriveOAuth2Info);

View file

@ -24,7 +24,9 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -34,6 +36,8 @@ public class HostrFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Localhostr; public override FileDestination EnumValue { get; } = FileDestination.Localhostr;
public override Icon ServiceIcon => Resources.Hostr;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.LocalhostrEmail) && !string.IsNullOrEmpty(config.LocalhostrPassword); return !string.IsNullOrEmpty(config.LocalhostrEmail) && !string.IsNullOrEmpty(config.LocalhostrPassword);

View file

@ -26,9 +26,11 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/gpailler // Credits: https://github.com/gpailler
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -42,6 +44,8 @@ public class JiraFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Jira; public override FileDestination EnumValue { get; } = FileDestination.Jira;
public override Image ServiceImage => Resources.jira;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return OAuthInfo.CheckOAuth(config.JiraOAuthInfo); return OAuthInfo.CheckOAuth(config.JiraOAuthInfo);

View file

@ -26,7 +26,9 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/mstojcevich // Credits: https://github.com/mstojcevich
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -36,6 +38,8 @@ public class LambdaFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Lambda; public override FileDestination EnumValue { get; } = FileDestination.Lambda;
public override Icon ServiceIcon => Resources.Lambda;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.LambdaSettings != null && !string.IsNullOrEmpty(config.LambdaSettings.UserAPIKey); return config.LambdaSettings != null && !string.IsNullOrEmpty(config.LambdaSettings.UserAPIKey);

View file

@ -26,7 +26,9 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/lithium720 // Credits: https://github.com/lithium720
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -36,6 +38,8 @@ public class LithiioFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Lithiio; public override FileDestination EnumValue { get; } = FileDestination.Lithiio;
public override Icon ServiceIcon => Resources.Lithiio;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.LithiioSettings != null; return config.LithiioSettings != null;

View file

@ -27,7 +27,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -42,6 +44,8 @@ public class MediaFireFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.MediaFire; public override FileDestination EnumValue { get; } = FileDestination.MediaFire;
public override Icon ServiceIcon => Resources.MediaFire;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.MediaFireUsername) && !string.IsNullOrEmpty(config.MediaFirePassword); return !string.IsNullOrEmpty(config.MediaFireUsername) && !string.IsNullOrEmpty(config.MediaFirePassword);

View file

@ -26,8 +26,10 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/gpailler // Credits: https://github.com/gpailler
using CG.Web.MegaApiClient; using CG.Web.MegaApiClient;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@ -38,6 +40,8 @@ public class MegaFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Mega; public override FileDestination EnumValue { get; } = FileDestination.Mega;
public override Icon ServiceIcon => Resources.Mega;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.MegaAuthInfos != null && config.MegaAuthInfos.Email != null && config.MegaAuthInfos.Hash != null && return config.MegaAuthInfos != null && config.MegaAuthInfos.Email != null && config.MegaAuthInfos.Hash != null &&

View file

@ -25,8 +25,10 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -36,6 +38,8 @@ public class MinusFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Minus; public override FileDestination EnumValue { get; } = FileDestination.Minus;
public override Icon ServiceIcon => Resources.Minus;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.MinusConfig != null && config.MinusConfig.MinusUser != null; return config.MinusConfig != null && config.MinusConfig.MinusUser != null;

View file

@ -28,6 +28,7 @@ You should have received a copy of the GNU General Public License
using ShareX.UploadersLib.Properties; using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -37,6 +38,8 @@ public class OneDriveFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.OneDrive; public override FileDestination EnumValue { get; } = FileDestination.OneDrive;
public override Icon ServiceIcon => Resources.OneDrive;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return OAuth2Info.CheckOAuth(config.OneDriveOAuth2Info); return OAuth2Info.CheckOAuth(config.OneDriveOAuth2Info);

View file

@ -26,9 +26,11 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -38,6 +40,8 @@ public class OwnCloudFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.OwnCloud; public override FileDestination EnumValue { get; } = FileDestination.OwnCloud;
public override Image ServiceImage => Resources.OwnCloud;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.OwnCloudHost) && !string.IsNullOrEmpty(config.OwnCloudUsername) && !string.IsNullOrEmpty(config.OwnCloudPassword); return !string.IsNullOrEmpty(config.OwnCloudHost) && !string.IsNullOrEmpty(config.OwnCloudUsername) && !string.IsNullOrEmpty(config.OwnCloudPassword);

View file

@ -41,6 +41,8 @@ public class PomfFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Pomf; public override FileDestination EnumValue { get; } = FileDestination.Pomf;
public override Icon ServiceIcon => Resources.Pomf;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.PomfUploader != null && !string.IsNullOrEmpty(config.PomfUploader.UploadURL); return config.PomfUploader != null && !string.IsNullOrEmpty(config.PomfUploader.UploadURL);
@ -189,4 +191,4 @@ public override string ToString()
} }
} }
} }
} }

View file

@ -27,9 +27,11 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@ -40,6 +42,8 @@ public class PushbulletFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Pushbullet; public override FileDestination EnumValue { get; } = FileDestination.Pushbullet;
public override Icon ServiceIcon => Resources.Pushbullet;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.PushbulletSettings != null && !string.IsNullOrEmpty(config.PushbulletSettings.UserAPIKey) && return config.PushbulletSettings != null && !string.IsNullOrEmpty(config.PushbulletSettings.UserAPIKey) &&

View file

@ -23,7 +23,9 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -33,6 +35,8 @@ public class PuushFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Puush; public override FileDestination EnumValue { get; } = FileDestination.Puush;
public override Icon ServiceIcon => Resources.puush;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.PuushAPIKey); return !string.IsNullOrEmpty(config.PuushAPIKey);

View file

@ -27,9 +27,11 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -39,6 +41,8 @@ public class SeafileFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Seafile; public override FileDestination EnumValue { get; } = FileDestination.Seafile;
public override Image ServiceImage => Resources.Seafile;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.SeafileAPIURL) && !string.IsNullOrEmpty(config.SeafileAuthToken) && !string.IsNullOrEmpty(config.SeafileRepoID); return !string.IsNullOrEmpty(config.SeafileAPIURL) && !string.IsNullOrEmpty(config.SeafileAuthToken) && !string.IsNullOrEmpty(config.SeafileRepoID);

View file

@ -24,9 +24,11 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
@ -39,6 +41,8 @@ public class SendSpaceFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.SendSpace; public override FileDestination EnumValue { get; } = FileDestination.SendSpace;
public override Icon ServiceIcon => Resources.SendSpace;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.SendSpaceAccountType == AccountType.Anonymous || return config.SendSpaceAccountType == AccountType.Anonymous ||

View file

@ -24,6 +24,8 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -33,6 +35,8 @@ public class SharedFolderFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.SharedFolder; public override FileDestination EnumValue { get; } = FileDestination.SharedFolder;
public override Image ServiceImage => Resources.server_network;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.LocalhostAccountList != null && config.LocalhostAccountList.IsValidIndex(config.LocalhostSelectedFiles); return config.LocalhostAccountList != null && config.LocalhostAccountList.IsValidIndex(config.LocalhostSelectedFiles);

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
@ -36,6 +38,8 @@ public class StreamableFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Streamable; public override FileDestination EnumValue { get; } = FileDestination.Streamable;
public override Icon ServiceIcon => Resources.Streamable;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -27,7 +27,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -37,6 +39,8 @@ public class SulFileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Sul; public override FileDestination EnumValue { get; } = FileDestination.Sul;
public override Image ServiceImage => Resources.Sul;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.SulAPIKey); return !string.IsNullOrEmpty(config.SulAPIKey);

View file

@ -28,8 +28,10 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using Security.Cryptography; using Security.Cryptography;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
@ -42,6 +44,8 @@ public class Up1FileUploaderService : FileUploaderService
{ {
public override FileDestination EnumValue { get; } = FileDestination.Up1; public override FileDestination EnumValue { get; } = FileDestination.Up1;
public override Icon ServiceIcon => Resources.Up1;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -91,54 +91,7 @@ private void InitializeControls()
uploadersImageList = new ImageList(); uploadersImageList = new ImageList();
uploadersImageList.ColorDepth = ColorDepth.Depth32Bit; uploadersImageList.ColorDepth = ColorDepth.Depth32Bit;
AddIconToTab(tpAdFly, Resources.AdFly); AddIconToTabs();
AddIconToTab(tpAmazonS3, Resources.AmazonS3);
AddIconToTab(tpBitly, Resources.Bitly);
AddIconToTab(tpBox, Resources.Box);
AddIconToTab(tpChevereto, Resources.Chevereto);
AddIconToTab(tpCoinURL, Resources.CoinURL);
AddIconToTab(tpCustomUploaders, Resources.globe_network);
AddIconToTab(tpDropbox, Resources.Dropbox);
AddIconToTab(tpEmail, Resources.mail);
AddIconToTab(tpFlickr, Resources.Flickr);
AddIconToTab(tpFTP, Resources.folder_network);
AddIconToTab(tpGe_tt, Resources.Gett);
AddIconToTab(tpGist, Resources.GitHub);
AddIconToTab(tpGoogleDrive, Resources.GoogleDrive);
AddIconToTab(tpGoogleURLShortener, Resources.Google);
AddIconToTab(tpHastebin, Resources.Hastebin);
AddIconToTab(tpHostr, Resources.Hostr);
AddIconToTab(tpImageShack, Resources.ImageShack);
AddIconToTab(tpImgur, Resources.Imgur);
AddIconToTab(tpJira, Resources.jira);
AddIconToTab(tpLambda, Resources.Lambda);
AddIconToTab(tpLithiio, Resources.Lithiio);
AddIconToTab(tpMediaFire, Resources.MediaFire);
AddIconToTab(tpMega, Resources.Mega);
AddIconToTab(tpMinus, Resources.Minus);
AddIconToTab(tpOneDrive, Resources.OneDrive);
AddIconToTab(tpOneTimeSecret, Resources.OneTimeSecret);
AddIconToTab(tpOwnCloud, Resources.OwnCloud);
AddIconToTab(tpPaste_ee, Resources.page_white_text);
AddIconToTab(tpPastebin, Resources.Pastebin);
AddIconToTab(tpPhotobucket, Resources.Photobucket);
AddIconToTab(tpPicasa, Resources.Picasa);
AddIconToTab(tpPolr, Resources.Polr);
AddIconToTab(tpPomf, Resources.Pomf);
AddIconToTab(tpPushbullet, Resources.Pushbullet);
AddIconToTab(tpPuush, Resources.puush);
AddIconToTab(tpSeafile, Resources.Seafile);
AddIconToTab(tpSendSpace, Resources.SendSpace);
AddIconToTab(tpSharedFolder, Resources.server_network);
AddIconToTab(tpSomeImage, Resources.SomeImage);
AddIconToTab(tpStreamable, Resources.Streamable);
AddIconToTab(tpSul, Resources.Sul);
AddIconToTab(tpTinyPic, Resources.TinyPic);
AddIconToTab(tpTwitter, Resources.Twitter);
AddIconToTab(tpUp1, Resources.Up1);
AddIconToTab(tpUpaste, Resources.Upaste);
AddIconToTab(tpVgyme, Resources.Vgyme);
AddIconToTab(tpYourls, Resources.Yourls);
ttlvMain.ImageList = uploadersImageList; ttlvMain.ImageList = uploadersImageList;
ttlvMain.MainTabControl = tcUploaders; ttlvMain.MainTabControl = tcUploaders;
@ -175,16 +128,33 @@ private void InitializeControls()
#endif #endif
} }
private void AddIconToTab(TabPage tp, Icon icon) private void AddIconToTabs()
{ {
uploadersImageList.Images.Add(tp.Name, icon); foreach (IUploaderService uploaderService in UploaderFactory.AllServices)
tp.ImageKey = tp.Name; {
} TabPage tp = uploaderService.GetUploadersConfigTabPage(this);
private void AddIconToTab(TabPage tp, Bitmap bitmap) if (tp != null)
{ {
uploadersImageList.Images.Add(tp.Name, bitmap); Icon icon = uploaderService.ServiceIcon;
tp.ImageKey = tp.Name;
if (icon != null)
{
uploadersImageList.Images.Add(tp.Name, icon);
tp.ImageKey = tp.Name;
}
else
{
Image img = uploaderService.ServiceImage;
if (img != null)
{
uploadersImageList.Images.Add(tp.Name, img);
tp.ImageKey = tp.Name;
}
}
}
}
} }
public void NavigateToTabPage(TabPage tp) public void NavigateToTabPage(TabPage tp)

View file

@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -40,6 +41,8 @@ public class CheveretoImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.Chevereto; public override ImageDestination EnumValue { get; } = ImageDestination.Chevereto;
public override Image ServiceImage => Resources.Chevereto;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.CheveretoUploader != null && !string.IsNullOrEmpty(config.CheveretoUploader.UploadURL) && return config.CheveretoUploader != null && !string.IsNullOrEmpty(config.CheveretoUploader.UploadURL) &&

View file

@ -24,9 +24,11 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@ -38,6 +40,8 @@ public class FlickrImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.Flickr; public override ImageDestination EnumValue { get; } = ImageDestination.Flickr;
public override Icon ServiceIcon => Resources.Flickr;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.FlickrAuthInfo.Token); return !string.IsNullOrEmpty(config.FlickrAuthInfo.Token);

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -35,6 +37,8 @@ public class ImageShackImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.ImageShack; public override ImageDestination EnumValue { get; } = ImageDestination.ImageShack;
public override Icon ServiceIcon => Resources.ImageShack;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.ImageShackSettings != null && !string.IsNullOrEmpty(config.ImageShackSettings.Auth_token); return config.ImageShackSettings != null && !string.IsNullOrEmpty(config.ImageShackSettings.Auth_token);

View file

@ -26,10 +26,12 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -55,6 +57,8 @@ public class ImgurImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.Imgur; public override ImageDestination EnumValue { get; } = ImageDestination.Imgur;
public override Icon ServiceIcon => Resources.Imgur;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.ImgurAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(config.ImgurOAuth2Info); return config.ImgurAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(config.ImgurOAuth2Info);

View file

@ -24,8 +24,10 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq; using System.Xml.Linq;
@ -36,6 +38,8 @@ public class PhotobucketImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.Photobucket; public override ImageDestination EnumValue { get; } = ImageDestination.Photobucket;
public override Icon ServiceIcon => Resources.Photobucket;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.PhotobucketAccountInfo != null && OAuthInfo.CheckOAuth(config.PhotobucketOAuthInfo); return config.PhotobucketAccountInfo != null && OAuthInfo.CheckOAuth(config.PhotobucketOAuthInfo);

View file

@ -25,8 +25,10 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq; using System.Xml.Linq;
@ -37,6 +39,8 @@ public class PicasaImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.Picasa; public override ImageDestination EnumValue { get; } = ImageDestination.Picasa;
public override Icon ServiceIcon => Resources.Picasa;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return OAuth2Info.CheckOAuth(config.PicasaOAuth2Info); return OAuth2Info.CheckOAuth(config.PicasaOAuth2Info);

View file

@ -26,8 +26,10 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/DanielMcAssey // Credits: https://github.com/DanielMcAssey
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -37,6 +39,8 @@ public class SomeImageImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.SomeImage; public override ImageDestination EnumValue { get; } = ImageDestination.SomeImage;
public override Icon ServiceIcon => Resources.SomeImage;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -24,7 +24,9 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Web; using System.Web;
using System.Windows.Forms; using System.Windows.Forms;
@ -36,6 +38,8 @@ public class TinyPicImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.TinyPic; public override ImageDestination EnumValue { get; } = ImageDestination.TinyPic;
public override Icon ServiceIcon => Resources.TinyPic;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.TinyPicAccountType == AccountType.Anonymous || !string.IsNullOrEmpty(config.TinyPicRegistrationCode); return config.TinyPicAccountType == AccountType.Anonymous || !string.IsNullOrEmpty(config.TinyPicRegistrationCode);

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -35,6 +37,8 @@ public class TwitterImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.Twitter; public override ImageDestination EnumValue { get; } = ImageDestination.Twitter;
public override Icon ServiceIcon => Resources.Twitter;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.TwitterOAuthInfoList != null && config.TwitterOAuthInfoList.IsValidIndex(config.TwitterSelectedAccount) && return config.TwitterOAuthInfoList != null && config.TwitterOAuthInfoList.IsValidIndex(config.TwitterSelectedAccount) &&

View file

@ -24,7 +24,9 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -34,6 +36,8 @@ public class VgymeImageUploaderService : ImageUploaderService
{ {
public override ImageDestination EnumValue { get; } = ImageDestination.Vgyme; public override ImageDestination EnumValue { get; } = ImageDestination.Vgyme;
public override Icon ServiceIcon => Resources.Vgyme;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -27,7 +27,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Net; using System.Net;
using System.Windows.Forms; using System.Windows.Forms;
@ -37,6 +39,8 @@ public class GitHubGistTextUploaderService : TextUploaderService
{ {
public override TextDestination EnumValue { get; } = TextDestination.Gist; public override TextDestination EnumValue { get; } = TextDestination.Gist;
public override Icon ServiceIcon => Resources.GitHub;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -25,6 +25,8 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.TextUploaders namespace ShareX.UploadersLib.TextUploaders
@ -33,6 +35,8 @@ public class HastebinTextUploaderService : TextUploaderService
{ {
public override TextDestination EnumValue { get; } = TextDestination.Hastebin; public override TextDestination EnumValue { get; } = TextDestination.Hastebin;
public override Image ServiceImage => Resources.Hastebin;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -27,8 +27,10 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.TextUploaders namespace ShareX.UploadersLib.TextUploaders
@ -37,6 +39,8 @@ public class OneTimeSecretTextUploaderService : TextUploaderService
{ {
public override TextDestination EnumValue { get; } = TextDestination.OneTimeSecret; public override TextDestination EnumValue { get; } = TextDestination.OneTimeSecret;
public override Icon ServiceIcon => Resources.OneTimeSecret;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -23,7 +23,9 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.TextUploaders namespace ShareX.UploadersLib.TextUploaders
@ -32,6 +34,8 @@ public class Paste_eeTextUploaderService : TextUploaderService
{ {
public override TextDestination EnumValue { get; } = TextDestination.Paste_ee; public override TextDestination EnumValue { get; } = TextDestination.Paste_ee;
public override Image ServiceImage => Resources.page_white_text;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -24,8 +24,10 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@ -35,6 +37,8 @@ public class PastebinTextUploaderService : TextUploaderService
{ {
public override TextDestination EnumValue { get; } = TextDestination.Pastebin; public override TextDestination EnumValue { get; } = TextDestination.Pastebin;
public override Icon ServiceIcon => Resources.Pastebin;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -24,8 +24,10 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.TextUploaders namespace ShareX.UploadersLib.TextUploaders
@ -34,6 +36,8 @@ public class UpasteTextUploaderService : TextUploaderService
{ {
public override TextDestination EnumValue { get; } = TextDestination.Upaste; public override TextDestination EnumValue { get; } = TextDestination.Upaste;
public override Icon ServiceIcon => Resources.Upaste;
public override bool CheckConfig(UploadersConfig config) => true; public override bool CheckConfig(UploadersConfig config) => true;
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/LRNAB // Credits: https://github.com/LRNAB
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.URLShorteners namespace ShareX.UploadersLib.URLShorteners
@ -34,6 +36,8 @@ public class AdFlyURLShortenerService : URLShortenerService
{ {
public override UrlShortenerType EnumValue { get; } = UrlShortenerType.AdFly; public override UrlShortenerType EnumValue { get; } = UrlShortenerType.AdFly;
public override Icon ServiceIcon => Resources.AdFly;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.AdFlyAPIKEY) && !string.IsNullOrEmpty(config.AdFlyAPIUID); return !string.IsNullOrEmpty(config.AdFlyAPIKEY) && !string.IsNullOrEmpty(config.AdFlyAPIUID);

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Web; using System.Web;
using System.Windows.Forms; using System.Windows.Forms;
@ -35,6 +37,8 @@ public class BitlyURLShortenerService : URLShortenerService
{ {
public override UrlShortenerType EnumValue { get; } = UrlShortenerType.BITLY; public override UrlShortenerType EnumValue { get; } = UrlShortenerType.BITLY;
public override Icon ServiceIcon => Resources.Bitly;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return OAuth2Info.CheckOAuth(config.BitlyOAuth2Info); return OAuth2Info.CheckOAuth(config.BitlyOAuth2Info);

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/DanielMcAssey // Credits: https://github.com/DanielMcAssey
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.URLShorteners namespace ShareX.UploadersLib.URLShorteners
@ -34,6 +36,8 @@ public class CoinURLShortenerService : URLShortenerService
{ {
public override UrlShortenerType EnumValue { get; } = UrlShortenerType.CoinURL; public override UrlShortenerType EnumValue { get; } = UrlShortenerType.CoinURL;
public override Icon ServiceIcon => Resources.CoinURL;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.CoinURLUUID); return !string.IsNullOrEmpty(config.CoinURLUUID);

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
using Newtonsoft.Json; using Newtonsoft.Json;
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.URLShorteners namespace ShareX.UploadersLib.URLShorteners
@ -34,6 +36,8 @@ public class GoogleURLShortenerService : URLShortenerService
{ {
public override UrlShortenerType EnumValue { get; } = UrlShortenerType.Google; public override UrlShortenerType EnumValue { get; } = UrlShortenerType.Google;
public override Icon ServiceIcon => Resources.Google;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return config.GoogleURLShortenerAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(config.GoogleURLShortenerOAuth2Info); return config.GoogleURLShortenerAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(config.GoogleURLShortenerOAuth2Info);

View file

@ -26,7 +26,9 @@ You should have received a copy of the GNU General Public License
// Credits: https://github.com/DanielMcAssey // Credits: https://github.com/DanielMcAssey
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.URLShorteners namespace ShareX.UploadersLib.URLShorteners
@ -35,6 +37,8 @@ public class PolrURLShortenerService : URLShortenerService
{ {
public override UrlShortenerType EnumValue { get; } = UrlShortenerType.Polr; public override UrlShortenerType EnumValue { get; } = UrlShortenerType.Polr;
public override Icon ServiceIcon => Resources.Polr;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.PolrAPIKey); return !string.IsNullOrEmpty(config.PolrAPIKey);

View file

@ -23,8 +23,10 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using ShareX.UploadersLib.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX.UploadersLib.URLShorteners namespace ShareX.UploadersLib.URLShorteners
@ -33,6 +35,8 @@ public class YourlsURLShortenerService : URLShortenerService
{ {
public override UrlShortenerType EnumValue { get; } = UrlShortenerType.YOURLS; public override UrlShortenerType EnumValue { get; } = UrlShortenerType.YOURLS;
public override Icon ServiceIcon => Resources.Yourls;
public override bool CheckConfig(UploadersConfig config) public override bool CheckConfig(UploadersConfig config)
{ {
return !string.IsNullOrEmpty(config.YourlsAPIURL) && (!string.IsNullOrEmpty(config.YourlsSignature) || return !string.IsNullOrEmpty(config.YourlsAPIURL) && (!string.IsNullOrEmpty(config.YourlsSignature) ||

View file

@ -31,6 +31,7 @@ namespace ShareX.UploadersLib
{ {
public static class UploaderFactory public static class UploaderFactory
{ {
public static List<IUploaderService> AllServices { get; } = new List<IUploaderService>();
public static Dictionary<ImageDestination, ImageUploaderService> ImageUploaderServices { get; } = CacheServices<ImageDestination, ImageUploaderService>(); public static Dictionary<ImageDestination, ImageUploaderService> ImageUploaderServices { get; } = CacheServices<ImageDestination, ImageUploaderService>();
public static Dictionary<TextDestination, TextUploaderService> TextUploaderServices { get; } = CacheServices<TextDestination, TextUploaderService>(); public static Dictionary<TextDestination, TextUploaderService> TextUploaderServices { get; } = CacheServices<TextDestination, TextUploaderService>();
public static Dictionary<FileDestination, FileUploaderService> FileUploaderServices { get; } = CacheServices<FileDestination, FileUploaderService>(); public static Dictionary<FileDestination, FileUploaderService> FileUploaderServices { get; } = CacheServices<FileDestination, FileUploaderService>();
@ -39,7 +40,11 @@ public static class UploaderFactory
private static Dictionary<T, T2> CacheServices<T, T2>() where T2 : UploaderService<T> private static Dictionary<T, T2> CacheServices<T, T2>() where T2 : UploaderService<T>
{ {
return Helpers.GetInstances<T2>().ToDictionary(x => x.EnumValue, x => x); T2[] instances = Helpers.GetInstances<T2>();
AllServices.AddRange(instances.Cast<IUploaderService>());
return instances.ToDictionary(x => x.EnumValue, x => x);
} }
} }
} }