2016-03-24 07:47:59 +13:00
|
|
|
|
#region License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ShareX - A program that allows you to take screenshots and share any file type
|
2019-01-02 20:43:52 +13:00
|
|
|
|
Copyright (c) 2007-2019 ShareX Team
|
2016-03-24 07:47:59 +13:00
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion License Information (GPL v3)
|
|
|
|
|
|
2016-03-23 15:45:12 +13:00
|
|
|
|
using ShareX.HelpersLib;
|
|
|
|
|
using ShareX.UploadersLib.FileUploaders;
|
2016-05-01 20:27:39 +12:00
|
|
|
|
using System.Windows.Forms;
|
2016-03-23 15:45:12 +13:00
|
|
|
|
|
|
|
|
|
namespace ShareX.UploadersLib.SharingServices
|
|
|
|
|
{
|
2016-03-24 07:47:59 +13:00
|
|
|
|
public class PushbulletSharingService : URLSharingService
|
2016-03-23 15:45:12 +13:00
|
|
|
|
{
|
|
|
|
|
public override URLSharingServices EnumValue { get; } = URLSharingServices.Pushbullet;
|
|
|
|
|
|
2016-03-24 07:47:59 +13:00
|
|
|
|
public override bool CheckConfig(UploadersConfig config)
|
2016-03-23 15:45:12 +13:00
|
|
|
|
{
|
2016-03-24 07:47:59 +13:00
|
|
|
|
PushbulletSettings pushbulletSettings = config.PushbulletSettings;
|
2016-03-23 15:45:12 +13:00
|
|
|
|
|
2016-05-01 20:27:39 +12:00
|
|
|
|
return pushbulletSettings != null && !string.IsNullOrEmpty(pushbulletSettings.UserAPIKey) && pushbulletSettings.DeviceList != null &&
|
|
|
|
|
pushbulletSettings.DeviceList.IsValidIndex(pushbulletSettings.SelectedDevice);
|
2016-03-23 15:45:12 +13:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-10 22:55:21 +12:00
|
|
|
|
public override URLSharer CreateSharer(UploadersConfig config, TaskReferenceHelper taskInfo)
|
2016-03-23 15:45:12 +13:00
|
|
|
|
{
|
2017-09-10 22:55:21 +12:00
|
|
|
|
return new PushbulletSharer(config.PushbulletSettings);
|
2016-03-23 15:45:12 +13:00
|
|
|
|
}
|
2016-05-01 20:27:39 +12:00
|
|
|
|
|
|
|
|
|
public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpPushbullet;
|
2016-03-23 15:45:12 +13:00
|
|
|
|
}
|
2017-09-10 22:55:21 +12:00
|
|
|
|
|
|
|
|
|
public sealed class PushbulletSharer : URLSharer
|
|
|
|
|
{
|
|
|
|
|
public PushbulletSettings Settings { get; private set; }
|
|
|
|
|
|
|
|
|
|
public PushbulletSharer(PushbulletSettings settings)
|
|
|
|
|
{
|
|
|
|
|
Settings = settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override UploadResult ShareURL(string url)
|
|
|
|
|
{
|
2017-09-11 00:29:29 +12:00
|
|
|
|
UploadResult result = new UploadResult { URL = url, IsURLExpected = false };
|
2017-09-10 22:55:21 +12:00
|
|
|
|
|
|
|
|
|
new Pushbullet(Settings).PushLink(url, "ShareX: URL share");
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-23 15:45:12 +13:00
|
|
|
|
}
|