mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-06 05:05:42 +13:00
commit
25099a9396
11 changed files with 345 additions and 1 deletions
|
@ -946,6 +946,11 @@ public UploadResult UploadFile(Stream stream, string fileName)
|
||||||
case FileDestination.MediaCrush:
|
case FileDestination.MediaCrush:
|
||||||
fileUploader = new MediaCrushUploader();
|
fileUploader = new MediaCrushUploader();
|
||||||
break;
|
break;
|
||||||
|
case FileDestination.MediaFire:
|
||||||
|
fileUploader = new MediaFire(APIKeys.MediaFireAppId, APIKeys.MediaFireApiKey,
|
||||||
|
Program.UploadersConfig.MediaFireUsername, Program.UploadersConfig.MediaFirePassword,
|
||||||
|
NameParser.Parse(NameParserType.URL, Program.UploadersConfig.MediaFirePath));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileUploader != null)
|
if (fileUploader != null)
|
||||||
|
|
|
@ -52,6 +52,8 @@ public static partial class APIKeys
|
||||||
public static string SendSpaceKey = "";
|
public static string SendSpaceKey = "";
|
||||||
public static string Ge_ttKey = "";
|
public static string Ge_ttKey = "";
|
||||||
public static string JiraConsumerKey = "";
|
public static string JiraConsumerKey = "";
|
||||||
|
public static string MediaFireAppId = "";
|
||||||
|
public static string MediaFireApiKey = "";
|
||||||
|
|
||||||
// Text Uploaders
|
// Text Uploaders
|
||||||
public static string PastebinKey = "";
|
public static string PastebinKey = "";
|
||||||
|
|
|
@ -117,7 +117,9 @@ public enum FileDestination
|
||||||
[Description("Email")]
|
[Description("Email")]
|
||||||
Email,
|
Email,
|
||||||
[Description("Custom file uploader")]
|
[Description("Custom file uploader")]
|
||||||
CustomFileUploader
|
CustomFileUploader,
|
||||||
|
[Description("MediaFire")]
|
||||||
|
MediaFire
|
||||||
}
|
}
|
||||||
|
|
||||||
[Description("URL shorteners"), DefaultValue(UrlShortenerType.BITLY)]
|
[Description("URL shorteners"), DefaultValue(UrlShortenerType.BITLY)]
|
||||||
|
|
BIN
UploadersLib/Favicons/MediaFire.ico
Normal file
BIN
UploadersLib/Favicons/MediaFire.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
198
UploadersLib/FileUploaders/MediaFire.cs
Normal file
198
UploadersLib/FileUploaders/MediaFire.cs
Normal file
|
@ -0,0 +1,198 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace UploadersLib.FileUploaders
|
||||||
|
{
|
||||||
|
public sealed class MediaFire : FileUploader
|
||||||
|
{
|
||||||
|
private static readonly string _apiUrl = "https://www.mediafire.com/api/";
|
||||||
|
private static readonly string _viewUrl = "http://www.mediafire.com/view/?";
|
||||||
|
private static readonly int _pollInterval = 3000;
|
||||||
|
private readonly string _appId, _apiKey, _user, _pasw, _path;
|
||||||
|
private string _sessionToken, _signatureTime;
|
||||||
|
private int _signatureKey;
|
||||||
|
|
||||||
|
public MediaFire(string appId, string apiKey, string user, string pasw, string path)
|
||||||
|
{
|
||||||
|
_appId = appId;
|
||||||
|
_apiKey = apiKey;
|
||||||
|
_user = user;
|
||||||
|
_pasw = pasw;
|
||||||
|
_path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override UploadResult Upload(Stream stream, string fileName)
|
||||||
|
{
|
||||||
|
GetSessionToken();
|
||||||
|
string key = SimpleUpload(stream, fileName);
|
||||||
|
string quickKey = null;
|
||||||
|
while ((quickKey = PollUpload(key, fileName)) == null) System.Threading.Thread.Sleep(_pollInterval);
|
||||||
|
return new UploadResult() { IsSuccess = true, URL = _viewUrl + quickKey };
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetSessionToken()
|
||||||
|
{
|
||||||
|
var args = new Dictionary<string, string>();
|
||||||
|
args.Add("email", _user);
|
||||||
|
args.Add("password", _pasw);
|
||||||
|
args.Add("application_id", _appId);
|
||||||
|
args.Add("token_version", "2");
|
||||||
|
args.Add("response_format", "json");
|
||||||
|
args.Add("signature", GetInitSignature());
|
||||||
|
string respStr = SendRequest(HttpMethod.POST, _apiUrl + "user/get_session_token.php", args);
|
||||||
|
GetSessionTokenResponse resp = DeserializeResponse<GetSessionTokenResponse>(respStr);
|
||||||
|
EnsureSuccess(resp);
|
||||||
|
if (resp.session_token == null || resp.time == null || resp.secret_key == null)
|
||||||
|
throw new IOException("Invalid response");
|
||||||
|
_sessionToken = resp.session_token;
|
||||||
|
_signatureTime = resp.time;
|
||||||
|
_signatureKey = (int)resp.secret_key;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string SimpleUpload(Stream stream, string fileName)
|
||||||
|
{
|
||||||
|
var args = new Dictionary<string, string>();
|
||||||
|
args.Add("session_token", _sessionToken);
|
||||||
|
args.Add("path", _path);
|
||||||
|
args.Add("response_format", "json");
|
||||||
|
args.Add("signature", GetSignature("upload/simple.php", args));
|
||||||
|
string url = CreateQuery(_apiUrl + "upload/simple.php", args);
|
||||||
|
UploadResult res = UploadData(stream, url, fileName, "Filedata");
|
||||||
|
if (!res.IsSuccess) throw new IOException(res.ErrorsToString());
|
||||||
|
SimpleUploadResponse resp = DeserializeResponse<SimpleUploadResponse>(res.Response);
|
||||||
|
EnsureSuccess(resp);
|
||||||
|
if (resp.doupload.result != 0 || resp.doupload.key == null) throw new IOException("Invalid response");
|
||||||
|
return resp.doupload.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string PollUpload(string uploadKey, string fileName)
|
||||||
|
{
|
||||||
|
var args = new Dictionary<string, string>();
|
||||||
|
args.Add("session_token", _sessionToken);
|
||||||
|
args.Add("key", uploadKey);
|
||||||
|
args.Add("filename", fileName);
|
||||||
|
args.Add("response_format", "json");
|
||||||
|
args.Add("signature", GetSignature("upload/poll_upload.php", args));
|
||||||
|
string respStr = SendRequest(HttpMethod.POST, _apiUrl + "upload/poll_upload.php", args);
|
||||||
|
PollUploadResponse resp = DeserializeResponse<PollUploadResponse>(respStr);
|
||||||
|
EnsureSuccess(resp);
|
||||||
|
if (resp.doupload.result == null || resp.doupload.status == null) throw new IOException("Invalid response");
|
||||||
|
if (resp.doupload.result != 0 || resp.doupload.fileerror != null) {
|
||||||
|
throw new IOException(string.Format("Couldn't upload the file: {0}", resp.doupload.description
|
||||||
|
?? "Unknown error"));
|
||||||
|
}
|
||||||
|
if (resp.doupload.status == 99) {
|
||||||
|
if (resp.doupload.quickkey == null) throw new IOException("Invalid response");
|
||||||
|
return resp.doupload.quickkey;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EnsureSuccess(MFResponse resp)
|
||||||
|
{
|
||||||
|
if (resp.result != "Success")
|
||||||
|
throw new IOException(string.Format("Couldn't upload the file: {0}", resp.message ?? "Unknown error"));
|
||||||
|
if (resp.new_key == "yes") NextSignatureKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetInitSignature()
|
||||||
|
{
|
||||||
|
string signatureStr = _user + _pasw + _appId + _apiKey;
|
||||||
|
byte[] signatureBytes = Encoding.ASCII.GetBytes(signatureStr);
|
||||||
|
System.Security.Cryptography.SHA1 sha1Gen = System.Security.Cryptography.SHA1.Create();
|
||||||
|
byte[] sha1Bytes = sha1Gen.ComputeHash(signatureBytes);
|
||||||
|
return BytesToString(sha1Bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetSignature(string urlSuffix, Dictionary<string,string> args)
|
||||||
|
{
|
||||||
|
string keyStr = (_signatureKey % 256).ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
string urlStr = CreateNonEscapedQuery("/api/" + urlSuffix, args);
|
||||||
|
string signatureStr = keyStr + _signatureTime + urlStr;
|
||||||
|
byte[] signatureBytes = Encoding.ASCII.GetBytes(signatureStr);
|
||||||
|
System.Security.Cryptography.MD5 md5gen = System.Security.Cryptography.MD5.Create();
|
||||||
|
byte[] md5Bytes = md5gen.ComputeHash(signatureBytes);
|
||||||
|
return BytesToString(md5Bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NextSignatureKey()
|
||||||
|
{
|
||||||
|
_signatureKey = (int)(((long)_signatureKey * 16807) % 2147483647);
|
||||||
|
}
|
||||||
|
|
||||||
|
private T DeserializeResponse<T>(string s) where T : new()
|
||||||
|
{
|
||||||
|
var refObj = new { response = new T() };
|
||||||
|
var obj = JsonConvert.DeserializeObject(s, refObj.GetType());
|
||||||
|
return (T)obj.GetType().GetProperty("response").GetValue(obj, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static char IntToChar(int x)
|
||||||
|
{
|
||||||
|
if (x < 10) return (char)(x + '0');
|
||||||
|
return (char)(x - 10 + 'a');
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BytesToString(byte[] b)
|
||||||
|
{
|
||||||
|
char[] res = new char[b.Length * 2];
|
||||||
|
for (int i = 0; i < b.Length; ++i) {
|
||||||
|
res[2 * i] = IntToChar(b[i] >> 4);
|
||||||
|
res[2 * i + 1] = IntToChar(b[i] & 0xf);
|
||||||
|
}
|
||||||
|
return new string(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string CreateNonEscapedQuery(string url, Dictionary<string, string> args)
|
||||||
|
{
|
||||||
|
if (args != null && args.Count > 0)
|
||||||
|
return url + "?" + string.Join("&", args.Select(x => x.Key + "=" + x.Value).ToArray());
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MFResponse
|
||||||
|
{
|
||||||
|
public string result { get; set; }
|
||||||
|
public int? error { get; set; }
|
||||||
|
public string message { get; set; }
|
||||||
|
public string new_key { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GetSessionTokenResponse : MFResponse
|
||||||
|
{
|
||||||
|
public string session_token { get; set; }
|
||||||
|
public int? secret_key { get; set; }
|
||||||
|
public string time { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SimpleUploadResponse : MFResponse
|
||||||
|
{
|
||||||
|
public DoUpload doupload { get; set; }
|
||||||
|
|
||||||
|
public class DoUpload
|
||||||
|
{
|
||||||
|
public int? result { get; set; }
|
||||||
|
public string key { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PollUploadResponse : MFResponse
|
||||||
|
{
|
||||||
|
public DoUpload doupload { get; set; }
|
||||||
|
|
||||||
|
public class DoUpload
|
||||||
|
{
|
||||||
|
public int? result { get; set; }
|
||||||
|
public int? status { get; set; }
|
||||||
|
public string description { get; set; }
|
||||||
|
public int? fileerror { get; set; }
|
||||||
|
public string quickkey { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
86
UploadersLib/Forms/UploadersConfigForm.Designer.cs
generated
86
UploadersLib/Forms/UploadersConfigForm.Designer.cs
generated
|
@ -380,6 +380,13 @@ private void InitializeComponent()
|
||||||
this.lblWidthHint = new System.Windows.Forms.Label();
|
this.lblWidthHint = new System.Windows.Forms.Label();
|
||||||
this.actRapidShareAccountType = new UploadersLib.AccountTypeControl();
|
this.actRapidShareAccountType = new UploadersLib.AccountTypeControl();
|
||||||
this.cbImgurDirectLink = new System.Windows.Forms.CheckBox();
|
this.cbImgurDirectLink = new System.Windows.Forms.CheckBox();
|
||||||
|
this.tpMediaFire = new System.Windows.Forms.TabPage();
|
||||||
|
this.txtMediaFirePassword = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtMediaFireUsername = new System.Windows.Forms.TextBox();
|
||||||
|
this.lblMediaFirePassword = new System.Windows.Forms.Label();
|
||||||
|
this.lblMediaFireUsername = new System.Windows.Forms.Label();
|
||||||
|
this.lblMediaFirePath = new System.Windows.Forms.Label();
|
||||||
|
this.txtMediaFirePath = new System.Windows.Forms.TextBox();
|
||||||
this.tpOtherUploaders.SuspendLayout();
|
this.tpOtherUploaders.SuspendLayout();
|
||||||
this.tcOtherUploaders.SuspendLayout();
|
this.tcOtherUploaders.SuspendLayout();
|
||||||
this.tpCustomUploaders.SuspendLayout();
|
this.tpCustomUploaders.SuspendLayout();
|
||||||
|
@ -435,6 +442,7 @@ private void InitializeComponent()
|
||||||
this.gbPhotobucketAlbums.SuspendLayout();
|
this.gbPhotobucketAlbums.SuspendLayout();
|
||||||
this.gbPhotobucketUserAccount.SuspendLayout();
|
this.gbPhotobucketUserAccount.SuspendLayout();
|
||||||
this.tpPicasa.SuspendLayout();
|
this.tpPicasa.SuspendLayout();
|
||||||
|
this.tpMediaFire.SuspendLayout();
|
||||||
this.tcUploaders.SuspendLayout();
|
this.tcUploaders.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -1388,6 +1396,7 @@ private void InitializeComponent()
|
||||||
this.tcFileUploaders.Controls.Add(this.tpJira);
|
this.tcFileUploaders.Controls.Add(this.tpJira);
|
||||||
this.tcFileUploaders.Controls.Add(this.tpEmail);
|
this.tcFileUploaders.Controls.Add(this.tpEmail);
|
||||||
this.tcFileUploaders.Controls.Add(this.tpSharedFolder);
|
this.tcFileUploaders.Controls.Add(this.tpSharedFolder);
|
||||||
|
this.tcFileUploaders.Controls.Add(this.tpMediaFire);
|
||||||
this.tcFileUploaders.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.tcFileUploaders.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.tcFileUploaders.Location = new System.Drawing.Point(3, 3);
|
this.tcFileUploaders.Location = new System.Drawing.Point(3, 3);
|
||||||
this.tcFileUploaders.Multiline = true;
|
this.tcFileUploaders.Multiline = true;
|
||||||
|
@ -3169,6 +3178,74 @@ private void InitializeComponent()
|
||||||
this.ucLocalhostAccounts.Name = "ucLocalhostAccounts";
|
this.ucLocalhostAccounts.Name = "ucLocalhostAccounts";
|
||||||
this.ucLocalhostAccounts.Size = new System.Drawing.Size(792, 448);
|
this.ucLocalhostAccounts.Size = new System.Drawing.Size(792, 448);
|
||||||
this.ucLocalhostAccounts.TabIndex = 6;
|
this.ucLocalhostAccounts.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// tpMediaFire
|
||||||
|
//
|
||||||
|
this.tpMediaFire.Controls.Add(this.txtMediaFirePath);
|
||||||
|
this.tpMediaFire.Controls.Add(this.lblMediaFirePath);
|
||||||
|
this.tpMediaFire.Controls.Add(this.txtMediaFirePassword);
|
||||||
|
this.tpMediaFire.Controls.Add(this.txtMediaFireUsername);
|
||||||
|
this.tpMediaFire.Controls.Add(this.lblMediaFirePassword);
|
||||||
|
this.tpMediaFire.Controls.Add(this.lblMediaFireUsername);
|
||||||
|
this.tpMediaFire.Location = new System.Drawing.Point(4, 40);
|
||||||
|
this.tpMediaFire.Name = "tpMediaFire";
|
||||||
|
this.tpMediaFire.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tpMediaFire.Size = new System.Drawing.Size(972, 475);
|
||||||
|
this.tpMediaFire.TabIndex = 16;
|
||||||
|
this.tpMediaFire.Text = "MediaFire";
|
||||||
|
this.tpMediaFire.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// txtMediaFirePassword
|
||||||
|
//
|
||||||
|
this.txtMediaFirePassword.Location = new System.Drawing.Point(80, 52);
|
||||||
|
this.txtMediaFirePassword.Name = "txtMediaFirePassword";
|
||||||
|
this.txtMediaFirePassword.PasswordChar = '*';
|
||||||
|
this.txtMediaFirePassword.Size = new System.Drawing.Size(136, 20);
|
||||||
|
this.txtMediaFirePassword.TabIndex = 3;
|
||||||
|
this.txtMediaFirePassword.TextChanged += new System.EventHandler(this.txtMediaFirePassword_TextChanged);
|
||||||
|
//
|
||||||
|
// txtMediaFireUsername
|
||||||
|
//
|
||||||
|
this.txtMediaFireUsername.Location = new System.Drawing.Point(80, 20);
|
||||||
|
this.txtMediaFireUsername.Name = "txtMediaFireUsername";
|
||||||
|
this.txtMediaFireUsername.Size = new System.Drawing.Size(136, 20);
|
||||||
|
this.txtMediaFireUsername.TabIndex = 2;
|
||||||
|
this.txtMediaFireUsername.TextChanged += new System.EventHandler(this.txtMediaFireUsername_TextChanged);
|
||||||
|
//
|
||||||
|
// lblMediaFirePassword
|
||||||
|
//
|
||||||
|
this.lblMediaFirePassword.AutoSize = true;
|
||||||
|
this.lblMediaFirePassword.Location = new System.Drawing.Point(16, 56);
|
||||||
|
this.lblMediaFirePassword.Name = "lblMediaFirePassword";
|
||||||
|
this.lblMediaFirePassword.Size = new System.Drawing.Size(56, 13);
|
||||||
|
this.lblMediaFirePassword.TabIndex = 1;
|
||||||
|
this.lblMediaFirePassword.Text = "Password:";
|
||||||
|
//
|
||||||
|
// lblMediaFireUsername
|
||||||
|
//
|
||||||
|
this.lblMediaFireUsername.AutoSize = true;
|
||||||
|
this.lblMediaFireUsername.Location = new System.Drawing.Point(16, 24);
|
||||||
|
this.lblMediaFireUsername.Name = "lblMediaFireUsername";
|
||||||
|
this.lblMediaFireUsername.Size = new System.Drawing.Size(58, 13);
|
||||||
|
this.lblMediaFireUsername.TabIndex = 0;
|
||||||
|
this.lblMediaFireUsername.Text = "Username:";
|
||||||
|
//
|
||||||
|
// lblMediaFirePath
|
||||||
|
//
|
||||||
|
this.lblMediaFirePath.AutoSize = true;
|
||||||
|
this.lblMediaFirePath.Location = new System.Drawing.Point(16, 88);
|
||||||
|
this.lblMediaFirePath.Name = "lblMediaFirePath";
|
||||||
|
this.lblMediaFirePath.Size = new System.Drawing.Size(68, 13);
|
||||||
|
this.lblMediaFirePath.TabIndex = 4;
|
||||||
|
this.lblMediaFirePath.Text = "Upload path:";
|
||||||
|
//
|
||||||
|
// txtMediaFirePath
|
||||||
|
//
|
||||||
|
this.txtMediaFirePath.Location = new System.Drawing.Point(88, 85);
|
||||||
|
this.txtMediaFirePath.Name = "txtMediaFirePath";
|
||||||
|
this.txtMediaFirePath.Size = new System.Drawing.Size(248, 20);
|
||||||
|
this.txtMediaFirePath.TabIndex = 5;
|
||||||
|
this.txtMediaFirePath.TextChanged += new System.EventHandler(this.txtMediaFirePath_TextChanged);
|
||||||
//
|
//
|
||||||
// btnCopyShowFiles
|
// btnCopyShowFiles
|
||||||
//
|
//
|
||||||
|
@ -4157,6 +4234,8 @@ private void InitializeComponent()
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudEmailSmtpPort)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudEmailSmtpPort)).EndInit();
|
||||||
this.tpSharedFolder.ResumeLayout(false);
|
this.tpSharedFolder.ResumeLayout(false);
|
||||||
this.tpSharedFolder.PerformLayout();
|
this.tpSharedFolder.PerformLayout();
|
||||||
|
this.tpMediaFire.ResumeLayout(false);
|
||||||
|
this.tpMediaFire.PerformLayout();
|
||||||
this.tpTextUploaders.ResumeLayout(false);
|
this.tpTextUploaders.ResumeLayout(false);
|
||||||
this.tcTextUploaders.ResumeLayout(false);
|
this.tcTextUploaders.ResumeLayout(false);
|
||||||
this.tpPastebin.ResumeLayout(false);
|
this.tpPastebin.ResumeLayout(false);
|
||||||
|
@ -4543,5 +4622,12 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.Label lblAdflyAPIKEY;
|
private System.Windows.Forms.Label lblAdflyAPIKEY;
|
||||||
private System.Windows.Forms.LinkLabel llAdflyLink;
|
private System.Windows.Forms.LinkLabel llAdflyLink;
|
||||||
private System.Windows.Forms.CheckBox cbImgurDirectLink;
|
private System.Windows.Forms.CheckBox cbImgurDirectLink;
|
||||||
|
private System.Windows.Forms.TabPage tpMediaFire;
|
||||||
|
private System.Windows.Forms.TextBox txtMediaFirePassword;
|
||||||
|
private System.Windows.Forms.TextBox txtMediaFireUsername;
|
||||||
|
private System.Windows.Forms.Label lblMediaFirePassword;
|
||||||
|
private System.Windows.Forms.Label lblMediaFireUsername;
|
||||||
|
private System.Windows.Forms.TextBox txtMediaFirePath;
|
||||||
|
private System.Windows.Forms.Label lblMediaFirePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -100,6 +100,7 @@ private void FormSettings()
|
||||||
uploadersImageList.Images.Add("Twitter", Resources.Twitter);
|
uploadersImageList.Images.Add("Twitter", Resources.Twitter);
|
||||||
uploadersImageList.Images.Add("ownCloud", Resources.OwnCloud);
|
uploadersImageList.Images.Add("ownCloud", Resources.OwnCloud);
|
||||||
uploadersImageList.Images.Add("AdFly", Resources.AdFly);
|
uploadersImageList.Images.Add("AdFly", Resources.AdFly);
|
||||||
|
uploadersImageList.Images.Add("MediaFire", Resources.MediaFire);
|
||||||
|
|
||||||
tpImageShack.ImageKey = "ImageShack";
|
tpImageShack.ImageKey = "ImageShack";
|
||||||
tpTinyPic.ImageKey = "TinyPic";
|
tpTinyPic.ImageKey = "TinyPic";
|
||||||
|
@ -134,6 +135,7 @@ private void FormSettings()
|
||||||
tpAmazonS3.ImageKey = "AmazonS3";
|
tpAmazonS3.ImageKey = "AmazonS3";
|
||||||
tpOwnCloud.ImageKey = "ownCloud";
|
tpOwnCloud.ImageKey = "ownCloud";
|
||||||
tpAdFly.ImageKey = "AdFly";
|
tpAdFly.ImageKey = "AdFly";
|
||||||
|
tpMediaFire.ImageKey = "MediaFire";
|
||||||
|
|
||||||
ttlvMain.ImageList = uploadersImageList;
|
ttlvMain.ImageList = uploadersImageList;
|
||||||
ttlvMain.MainTabControl = tcUploaders;
|
ttlvMain.MainTabControl = tcUploaders;
|
||||||
|
@ -142,6 +144,7 @@ private void FormSettings()
|
||||||
NameParser.CreateCodesMenu(txtDropboxPath, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
NameParser.CreateCodesMenu(txtDropboxPath, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
||||||
NameParser.CreateCodesMenu(txtCopyPath, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
NameParser.CreateCodesMenu(txtCopyPath, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
||||||
NameParser.CreateCodesMenu(txtAmazonS3ObjectPrefix, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
NameParser.CreateCodesMenu(txtAmazonS3ObjectPrefix, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
||||||
|
NameParser.CreateCodesMenu(txtMediaFirePath, ReplacementVariables.n, ReplacementVariables.t, ReplacementVariables.pn);
|
||||||
NameParser.CreateCodesMenu(txtCustomUploaderArgValue, ReplacementVariables.n);
|
NameParser.CreateCodesMenu(txtCustomUploaderArgValue, ReplacementVariables.n);
|
||||||
|
|
||||||
txtCustomUploaderLog.AddContextMenu();
|
txtCustomUploaderLog.AddContextMenu();
|
||||||
|
@ -488,6 +491,12 @@ public void LoadSettings(UploadersConfig uploadersConfig)
|
||||||
cbOwnCloudCreateShare.Checked = Config.OwnCloudCreateShare;
|
cbOwnCloudCreateShare.Checked = Config.OwnCloudCreateShare;
|
||||||
cbOwnCloudDirectLink.Checked = Config.OwnCloudDirectLink;
|
cbOwnCloudDirectLink.Checked = Config.OwnCloudDirectLink;
|
||||||
|
|
||||||
|
// MediaFire
|
||||||
|
|
||||||
|
txtMediaFireUsername.Text = Config.MediaFireUsername;
|
||||||
|
txtMediaFirePassword.Text = Config.MediaFirePassword;
|
||||||
|
txtMediaFirePath.Text = Config.MediaFirePath;
|
||||||
|
|
||||||
#endregion File uploaders
|
#endregion File uploaders
|
||||||
|
|
||||||
#region URL Shorteners
|
#region URL Shorteners
|
||||||
|
@ -1778,6 +1787,25 @@ private void SettingsGrid_LocalhostPropertyValueChanged(object s, PropertyValueC
|
||||||
|
|
||||||
#endregion Shared folder
|
#endregion Shared folder
|
||||||
|
|
||||||
|
#region MediaFire
|
||||||
|
|
||||||
|
private void txtMediaFireUsername_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Config.MediaFireUsername = txtMediaFireUsername.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtMediaFirePassword_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Config.MediaFirePassword = txtMediaFirePassword.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtMediaFirePath_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Config.MediaFirePath = txtMediaFirePath.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion File Uploaders
|
#endregion File Uploaders
|
||||||
|
|
||||||
#region URL Shorteners
|
#region URL Shorteners
|
||||||
|
|
10
UploadersLib/Properties/Resources.Designer.cs
generated
10
UploadersLib/Properties/Resources.Designer.cs
generated
|
@ -300,6 +300,16 @@ internal static System.Drawing.Bitmap mail {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Icon MediaFire {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("MediaFire", resourceCulture);
|
||||||
|
return ((System.Drawing.Icon)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -310,4 +310,7 @@
|
||||||
<data name="AdFly" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="AdFly" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\favicons\adfly.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\favicons\adfly.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="MediaFire" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Favicons\MediaFire.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -218,6 +218,12 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
|
||||||
public bool OwnCloudCreateShare = true;
|
public bool OwnCloudCreateShare = true;
|
||||||
public bool OwnCloudDirectLink = false;
|
public bool OwnCloudDirectLink = false;
|
||||||
|
|
||||||
|
// MediaFire
|
||||||
|
|
||||||
|
public string MediaFireUsername = "";
|
||||||
|
public string MediaFirePassword = "";
|
||||||
|
public string MediaFirePath = "";
|
||||||
|
|
||||||
#endregion File uploaders
|
#endregion File uploaders
|
||||||
|
|
||||||
#region URL shorteners
|
#region URL shorteners
|
||||||
|
@ -375,6 +381,8 @@ public bool IsValid(FileDestination destination)
|
||||||
PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice);
|
PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice);
|
||||||
case FileDestination.OwnCloud:
|
case FileDestination.OwnCloud:
|
||||||
return !string.IsNullOrEmpty(OwnCloudHost) && !string.IsNullOrEmpty(OwnCloudUsername) && !string.IsNullOrEmpty(OwnCloudPassword);
|
return !string.IsNullOrEmpty(OwnCloudHost) && !string.IsNullOrEmpty(OwnCloudUsername) && !string.IsNullOrEmpty(OwnCloudPassword);
|
||||||
|
case FileDestination.MediaFire:
|
||||||
|
return !string.IsNullOrEmpty(MediaFireUsername) && !string.IsNullOrEmpty(MediaFirePassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -109,6 +109,7 @@
|
||||||
<Compile Include="FileUploaders\GoogleDrive.cs" />
|
<Compile Include="FileUploaders\GoogleDrive.cs" />
|
||||||
<Compile Include="FileUploaders\Jira.cs" />
|
<Compile Include="FileUploaders\Jira.cs" />
|
||||||
<Compile Include="FileUploaders\Hostr.cs" />
|
<Compile Include="FileUploaders\Hostr.cs" />
|
||||||
|
<Compile Include="FileUploaders\MediaFire.cs" />
|
||||||
<Compile Include="FileUploaders\Mega.cs" />
|
<Compile Include="FileUploaders\Mega.cs" />
|
||||||
<Compile Include="FileUploaders\OneDrive.cs" />
|
<Compile Include="FileUploaders\OneDrive.cs" />
|
||||||
<Compile Include="FileUploaders\OwnCloud.cs" />
|
<Compile Include="FileUploaders\OwnCloud.cs" />
|
||||||
|
@ -426,6 +427,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Favicons\AdFly.ico" />
|
<Content Include="Favicons\AdFly.ico" />
|
||||||
<Content Include="Favicons\AmazonS3.ico" />
|
<Content Include="Favicons\AmazonS3.ico" />
|
||||||
|
<None Include="Resources\MediaFire.ico" />
|
||||||
<None Include="Favicons\GitHub.ico" />
|
<None Include="Favicons\GitHub.ico" />
|
||||||
<Content Include="Favicons\Hostr.ico" />
|
<Content Include="Favicons\Hostr.ico" />
|
||||||
<Content Include="Favicons\OwnCloud.png" />
|
<Content Include="Favicons\OwnCloud.png" />
|
||||||
|
|
Loading…
Reference in a new issue