Added dropfile.to file uploader

This commit is contained in:
Jaex 2015-06-20 09:36:44 +03:00
parent 50d309af98
commit fe8b755406
5 changed files with 95 additions and 4 deletions

View file

@ -122,6 +122,8 @@ public enum FileDestination
Imgrush,
[Description("VideoBin")]
VideoBin,
[Description("Dropfile")]
Dropfile,
SharedFolder, // Localized
Email, // Localized
CustomFileUploader // Localized

View 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; }
}
}
}

View file

@ -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;
namespace ShareX.UploadersLib.FileUploaders
@ -6,16 +31,16 @@ namespace ShareX.UploadersLib.FileUploaders
public sealed class VideoBin : FileUploader
{
private const string URLUpload = "https://videobin.org/add";
public override UploadResult Upload(Stream stream, string fileName)
{
Dictionary<string, string> arguments = new Dictionary<string, string>();
arguments.Add("api", "1");
UploadResult result = UploadData(stream, URLUpload, fileName, "videoFile", arguments);
result.URL = result.Response;
return result;
}
}

View file

@ -106,6 +106,7 @@
<Compile Include="FileUploaders\AmazonS3Region.cs" />
<Compile Include="FileUploaders\AmazonS3Settings.cs" />
<Compile Include="FileUploaders\Box.cs" />
<Compile Include="FileUploaders\Dropfile.cs" />
<Compile Include="FileUploaders\Lambda.cs" />
<Compile Include="FileUploaders\Copy.cs" />
<Compile Include="FileUploaders\Email.cs" />

View file

@ -1003,6 +1003,9 @@ public UploadResult UploadFile(Stream stream, string fileName)
case FileDestination.VideoBin:
fileUploader = new VideoBin();
break;
case FileDestination.Dropfile:
fileUploader = new Dropfile();
break;
}
if (fileUploader != null)