Renamed Maxfile to Pomf and it will support all Pomf uploaders

This commit is contained in:
Jaex 2015-10-05 20:54:29 +03:00
parent 513c136ea1
commit 4b546f4d90
6 changed files with 34 additions and 55 deletions

View file

@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using Newtonsoft.Json;
using System.ComponentModel;
namespace ShareX.UploadersLib
@ -124,10 +125,8 @@ public enum FileDestination
Imgrush,
[Description("VideoBin")]
VideoBin,
[Description("MaxFile")]
MaxFile,
[Description("Pomf.cat")]
PomfCat,
[Description("Pomf")]
Pomf,
[Description("Dropfile")]
Dropfile,
[Description("Up1")]

View file

@ -32,12 +32,22 @@ namespace ShareX.UploadersLib.FileUploaders
{
public class Pomf : FileUploader
{
protected string UploadURL = "https://pomf.se/upload.php";
protected string ResultURL = "https://a.pomf.se";
public static List<PomfUploader> Uploaders = new List<PomfUploader>()
{
//new PomfUploader("pomf.se", "https://pomf.se/upload.php", "https://a.pomf.se"),
new PomfUploader("maxfile.ro", "https://maxfile.ro/static/upload.php", "https://d.maxfile.ro")
};
public PomfUploader Uploader { get; set; }
public Pomf(PomfUploader uploader)
{
Uploader = uploader;
}
public override UploadResult Upload(Stream stream, string fileName)
{
UploadResult result = UploadData(stream, UploadURL, fileName, "files[]");
UploadResult result = UploadData(stream, Uploader.UploadURL, fileName, "files[]");
if (result.IsSuccess)
{
@ -45,7 +55,7 @@ public override UploadResult Upload(Stream stream, string fileName)
if (response.success && response.files != null && response.files.Count > 0)
{
result.URL = URLHelpers.CombineURL(ResultURL, response.files[0].url);
result.URL = URLHelpers.CombineURL(Uploader.ResultURL, response.files[0].url);
}
}

View file

@ -1,36 +0,0 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2015 ShareX Team
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)
namespace ShareX.UploadersLib.FileUploaders
{
public sealed class PomfCat : Pomf
{
public PomfCat()
{
UploadURL = "https://pomf.cat/upload.php";
ResultURL = "https://a.pomf.cat";
}
}
}

View file

@ -23,14 +23,24 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ShareX.UploadersLib.FileUploaders
{
public sealed class MaxFile : Pomf
public class PomfUploader
{
public MaxFile()
public string Name { get; set; }
public string UploadURL { get; set; }
public string ResultURL { get; set; }
public PomfUploader(string name, string uploadURL, string resultURL)
{
UploadURL = "https://maxfile.ro/static/upload.php";
ResultURL = "https://d.maxfile.ro";
Name = name;
UploadURL = uploadURL;
ResultURL = resultURL;
}
}
}

View file

@ -132,13 +132,12 @@
<Compile Include="FileUploaders\GoogleDrive.cs" />
<Compile Include="FileUploaders\Jira.cs" />
<Compile Include="FileUploaders\Hostr.cs" />
<Compile Include="FileUploaders\MaxFile.cs" />
<Compile Include="FileUploaders\MediaFire.cs" />
<Compile Include="FileUploaders\Mega.cs" />
<Compile Include="FileUploaders\OneDrive.cs" />
<Compile Include="FileUploaders\OwnCloud.cs" />
<Compile Include="FileUploaders\Pomf.cs" />
<Compile Include="FileUploaders\PomfCat.cs" />
<Compile Include="FileUploaders\PomfUploader.cs" />
<Compile Include="FileUploaders\SFTP.cs" />
<Compile Include="FileUploaders\Minus.cs" />
<Compile Include="FileUploaders\SharedFolderUploader.cs" />

View file

@ -1069,11 +1069,8 @@ public UploadResult UploadFile(Stream stream, string fileName)
case FileDestination.VideoBin:
fileUploader = new VideoBin();
break;
case FileDestination.MaxFile:
fileUploader = new MaxFile();
break;
case FileDestination.PomfCat:
fileUploader = new PomfCat();
case FileDestination.Pomf:
fileUploader = new Pomf(Pomf.Uploaders[0]);
break;
case FileDestination.Dropfile:
fileUploader = new Dropfile();