diff --git a/ShareX.UploadersLib/FileUploaders/OneDrive.cs b/ShareX.UploadersLib/FileUploaders/OneDrive.cs
deleted file mode 100644
index 16f9ac4e4..000000000
--- a/ShareX.UploadersLib/FileUploaders/OneDrive.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-#region License Information (GPL v3)
-
-/*
- ShareX - A program that allows you to take screenshots and share any file type
- Copyright (C) 2007-2014 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 .
-*/
-
-#endregion License Information (GPL v3)
-
-// Credits: https://github.com/l0nley
-
-using Newtonsoft.Json;
-using ShareX.UploadersLib.HelperClasses;
-using System.Collections.Generic;
-using System.IO;
-
-namespace ShareX.UploadersLib.FileUploaders
-{
- public sealed class OneDrive : FileUploader, IOAuth2
- {
- public OAuth2Info AuthInfo { get; private set; }
-
- public string FolderID { get; set; }
-
- public OneDrive(OAuth2Info authInfo)
- {
- AuthInfo = authInfo;
- }
-
- public override UploadResult Upload(Stream stream, string fileName)
- {
- if (!CheckAuthorization())
- {
- return null;
- }
-
- if (string.IsNullOrEmpty(FolderID))
- {
- FolderID = "me/skydrive/files";
- }
-
- Dictionary args = new Dictionary();
- args.Add("access_token", AuthInfo.Token.access_token);
- args.Add("overwrite", "true");
-
- string url = string.Format("https://apis.live.net/v5.0/{0}/{1}", FolderID, fileName);
- UploadResult result = UploadData(stream, url, string.Empty, arguments: args, method: HttpMethod.PUT);
-
- if (result.IsSuccess)
- {
- OneDriveUploadInfo resultJson = JsonConvert.DeserializeObject(result.Response);
- result.URL = resultJson.source;
- }
-
- return result;
- }
-
- public string GetAuthorizationURL()
- {
- Dictionary args = new Dictionary();
- args.Add("response_type", "code");
- args.Add("client_id", AuthInfo.Client_ID);
- args.Add("scope", "wl.skydrive_update");
-
- return CreateQuery("https://login.live.com/oauth20_authorize.srf", args);
- }
-
- public bool GetAccessToken(string code)
- {
- Dictionary args = new Dictionary();
- args.Add("grant_type", "authorization_code");
- args.Add("code", code);
- args.Add("client_id", AuthInfo.Client_ID);
- args.Add("client_secret", AuthInfo.Client_Secret);
-
- string response = SendRequest(HttpMethod.POST, "https://login.live.com/oauth20_token.srf", args);
-
- if (string.IsNullOrEmpty(response))
- {
- return false;
- }
-
- OAuth2Token token = JsonConvert.DeserializeObject(response);
-
- if (token == null || string.IsNullOrEmpty(token.access_token))
- {
- return false;
- }
-
- token.UpdateExpireDate();
- AuthInfo.Token = token;
- return true;
- }
-
- public bool RefreshAccessToken()
- {
- if (!OAuth2Info.CheckOAuth(AuthInfo) || string.IsNullOrEmpty(AuthInfo.Token.refresh_token))
- {
- return false;
- }
-
- Dictionary args = new Dictionary();
- args.Add("grant_type", "refresh_token");
- args.Add("refresh_token", AuthInfo.Token.refresh_token);
- args.Add("client_id", AuthInfo.Client_ID);
- args.Add("client_secret", AuthInfo.Client_Secret);
-
- string response = SendRequest(HttpMethod.POST, "https://login.live.com/oauth20_token.srf", args);
-
- if (string.IsNullOrEmpty(response))
- {
- return false;
- }
-
- OAuth2Token token = JsonConvert.DeserializeObject(response);
-
- if (token == null || string.IsNullOrEmpty(token.access_token))
- {
- return false;
- }
-
- token.UpdateExpireDate();
- AuthInfo.Token = token;
- return true;
- }
-
- public bool CheckAuthorization()
- {
- if (OAuth2Info.CheckOAuth(AuthInfo))
- {
- if (!AuthInfo.Token.IsExpired || RefreshAccessToken())
- {
- return true;
- }
-
- Errors.Add("Refresh access token failed.");
- return false;
- }
-
- Errors.Add("OneDrive login is required.");
- return false;
- }
- }
-
- internal sealed class OneDriveUploadInfo
- {
- public string id { get; set; }
- public string source { get; set; }
- }
-}
\ No newline at end of file
diff --git a/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs b/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs
index afcedd310..67bdfd80c 100644
--- a/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs
+++ b/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs
@@ -898,7 +898,7 @@ private void BoxAddFolder(BoxFileEntry folder)
public void OneDriveAuthOpen()
{
- try
+ /*try
{
OAuth2Info oauth = new OAuth2Info(APIKeys.OneDriveClientID, APIKeys.OneDriveClientSecret);
string url = new OneDrive(oauth).GetAuthorizationURL();
@@ -917,12 +917,12 @@ public void OneDriveAuthOpen()
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "ShareX - " + Resources.UploadersConfigForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
+ }*/
}
public void OneDriveAuthComplete(string code)
{
- try
+ /*try
{
if (!string.IsNullOrEmpty(code) && Config.OneDriveOAuth2Info != null)
{
@@ -946,7 +946,7 @@ public void OneDriveAuthComplete(string code)
{
DebugHelper.WriteException(ex);
MessageBox.Show(ex.ToString(), "ShareX - " + Resources.UploadersConfigForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
+ }*/
}
#endregion OneDrive
diff --git a/ShareX.UploadersLib/ShareX.UploadersLib.csproj b/ShareX.UploadersLib/ShareX.UploadersLib.csproj
index 7feda5150..6f8f71f0d 100644
--- a/ShareX.UploadersLib/ShareX.UploadersLib.csproj
+++ b/ShareX.UploadersLib/ShareX.UploadersLib.csproj
@@ -109,7 +109,6 @@
-