mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Added dropfile.to file uploader
This commit is contained in:
parent
50d309af98
commit
fe8b755406
5 changed files with 95 additions and 4 deletions
|
@ -122,6 +122,8 @@ public enum FileDestination
|
||||||
Imgrush,
|
Imgrush,
|
||||||
[Description("VideoBin")]
|
[Description("VideoBin")]
|
||||||
VideoBin,
|
VideoBin,
|
||||||
|
[Description("Dropfile")]
|
||||||
|
Dropfile,
|
||||||
SharedFolder, // Localized
|
SharedFolder, // Localized
|
||||||
Email, // Localized
|
Email, // Localized
|
||||||
CustomFileUploader // Localized
|
CustomFileUploader // Localized
|
||||||
|
|
60
ShareX.UploadersLib/FileUploaders/Dropfile.cs
Normal file
60
ShareX.UploadersLib/FileUploaders/Dropfile.cs
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
#region License Information (GPL v3)
|
||||||
|
|
||||||
|
/*
|
||||||
|
ShareX - A program that allows you to take screenshots and share any file type
|
||||||
|
Copyright © 2007-2015 ShareX Developers
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ShareX.UploadersLib.FileUploaders
|
||||||
|
{
|
||||||
|
public sealed class Dropfile : FileUploader
|
||||||
|
{
|
||||||
|
public override UploadResult Upload(Stream stream, string fileName)
|
||||||
|
{
|
||||||
|
UploadResult result = UploadData(stream, "https://dropfile.to/upload", fileName);
|
||||||
|
|
||||||
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
DropfileResponse response = JsonConvert.DeserializeObject<DropfileResponse>(result.Response);
|
||||||
|
|
||||||
|
if (response != null && response.Status == 0)
|
||||||
|
{
|
||||||
|
result.URL = response.URL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DropfileResponse
|
||||||
|
{
|
||||||
|
public int Status { get; set; }
|
||||||
|
public string URL { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,29 @@
|
||||||
using System.Collections.Generic;
|
#region License Information (GPL v3)
|
||||||
|
|
||||||
|
/*
|
||||||
|
ShareX - A program that allows you to take screenshots and share any file type
|
||||||
|
Copyright © 2007-2015 ShareX Developers
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace ShareX.UploadersLib.FileUploaders
|
namespace ShareX.UploadersLib.FileUploaders
|
||||||
|
@ -6,16 +31,16 @@ namespace ShareX.UploadersLib.FileUploaders
|
||||||
public sealed class VideoBin : FileUploader
|
public sealed class VideoBin : FileUploader
|
||||||
{
|
{
|
||||||
private const string URLUpload = "https://videobin.org/add";
|
private const string URLUpload = "https://videobin.org/add";
|
||||||
|
|
||||||
public override UploadResult Upload(Stream stream, string fileName)
|
public override UploadResult Upload(Stream stream, string fileName)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> arguments = new Dictionary<string, string>();
|
Dictionary<string, string> arguments = new Dictionary<string, string>();
|
||||||
arguments.Add("api", "1");
|
arguments.Add("api", "1");
|
||||||
|
|
||||||
UploadResult result = UploadData(stream, URLUpload, fileName, "videoFile", arguments);
|
UploadResult result = UploadData(stream, URLUpload, fileName, "videoFile", arguments);
|
||||||
|
|
||||||
result.URL = result.Response;
|
result.URL = result.Response;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
<Compile Include="FileUploaders\AmazonS3Region.cs" />
|
<Compile Include="FileUploaders\AmazonS3Region.cs" />
|
||||||
<Compile Include="FileUploaders\AmazonS3Settings.cs" />
|
<Compile Include="FileUploaders\AmazonS3Settings.cs" />
|
||||||
<Compile Include="FileUploaders\Box.cs" />
|
<Compile Include="FileUploaders\Box.cs" />
|
||||||
|
<Compile Include="FileUploaders\Dropfile.cs" />
|
||||||
<Compile Include="FileUploaders\Lambda.cs" />
|
<Compile Include="FileUploaders\Lambda.cs" />
|
||||||
<Compile Include="FileUploaders\Copy.cs" />
|
<Compile Include="FileUploaders\Copy.cs" />
|
||||||
<Compile Include="FileUploaders\Email.cs" />
|
<Compile Include="FileUploaders\Email.cs" />
|
||||||
|
|
|
@ -1003,6 +1003,9 @@ public UploadResult UploadFile(Stream stream, string fileName)
|
||||||
case FileDestination.VideoBin:
|
case FileDestination.VideoBin:
|
||||||
fileUploader = new VideoBin();
|
fileUploader = new VideoBin();
|
||||||
break;
|
break;
|
||||||
|
case FileDestination.Dropfile:
|
||||||
|
fileUploader = new Dropfile();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileUploader != null)
|
if (fileUploader != null)
|
||||||
|
|
Loading…
Reference in a new issue