diff --git a/ShareX.UploadersLib/FileUploaders/AmazonS3.cs b/ShareX.UploadersLib/FileUploaders/AmazonS3.cs
deleted file mode 100644
index ac7eb254a..000000000
--- a/ShareX.UploadersLib/FileUploaders/AmazonS3.cs
+++ /dev/null
@@ -1,226 +0,0 @@
-#region License Information (GPL v3)
-
-/*
- ShareX - A program that allows you to take screenshots and share any file type
- Copyright (c) 2007-2017 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 .
-*/
-
-#endregion License Information (GPL v3)
-
-// Credits: https://github.com/alanedwardes
-
-using Amazon;
-using Amazon.Runtime;
-using Amazon.S3;
-using Amazon.S3.Model;
-using ShareX.HelpersLib;
-using ShareX.UploadersLib.Properties;
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Windows.Forms;
-
-namespace ShareX.UploadersLib.FileUploaders
-{
- public class AmazonS3FileUploaderService : FileUploaderService
- {
- public override FileDestination EnumValue { get; } = FileDestination.AmazonS3;
-
- public override Icon ServiceIcon => Resources.AmazonS3;
-
- public override bool CheckConfig(UploadersConfig config)
- {
- return config.AmazonS3Settings != null && !string.IsNullOrEmpty(config.AmazonS3Settings.AccessKeyID) &&
- !string.IsNullOrEmpty(config.AmazonS3Settings.SecretAccessKey) && !string.IsNullOrEmpty(config.AmazonS3Settings.Bucket) &&
- AmazonS3.GetCurrentRegion(config.AmazonS3Settings) != AmazonS3.UnknownEndpoint;
- }
-
- public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)
- {
- return new AmazonS3(config.AmazonS3Settings);
- }
-
- public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpAmazonS3;
- }
-
- public sealed class AmazonS3 : FileUploader
- {
- public static readonly AmazonS3Region UnknownEndpoint = new AmazonS3Region("Unknown Endpoint");
- public static readonly AmazonS3Region DreamObjectsEndpoint = new AmazonS3Region("DreamObjects", "dreamobjects", "objects-us-west-1.dream.io");
-
- private static IList regionEndpoints = new List();
-
- public static IEnumerable RegionEndpoints
- {
- get
- {
- if (!regionEndpoints.Any())
- {
- regionEndpoints.Add(UnknownEndpoint);
- RegionEndpoint.EnumerableAllRegions.Select(r => new AmazonS3Region(r)).ForEach(regionEndpoints.Add);
- regionEndpoints.Add(DreamObjectsEndpoint);
- }
-
- return regionEndpoints;
- }
- }
-
- private AmazonS3Settings s3Settings { get; set; }
-
- public AmazonS3(AmazonS3Settings s3Settings)
- {
- this.s3Settings = s3Settings;
- }
-
- private string GetObjectStorageClass()
- {
- return s3Settings.UseReducedRedundancyStorage ? "REDUCED_REDUNDANCY" : "STANDARD";
- }
-
- public static AmazonS3Region GetCurrentRegion(AmazonS3Settings s3Settings)
- {
- return RegionEndpoints.SingleOrDefault(r => r.Identifier == s3Settings.Endpoint) ?? UnknownEndpoint;
- }
-
- private string GetEndpoint()
- {
- return URLHelpers.ForcePrefix(URLHelpers.CombineURL(GetCurrentRegion(s3Settings).Hostname, s3Settings.Bucket));
- }
-
- private AWSCredentials GetCurrentCredentials()
- {
- return new BasicAWSCredentials(s3Settings.AccessKeyID, s3Settings.SecretAccessKey);
- }
-
- private string GetObjectKey(string fileName)
- {
- string objectPrefix = NameParser.Parse(NameParserType.FolderPath, s3Settings.ObjectPrefix.Trim('/'));
- return URLHelpers.CombineURL(objectPrefix, fileName);
- }
-
- private string GetObjectURL(string objectName)
- {
- objectName = objectName.Trim('/');
- objectName = URLHelpers.URLPathEncode(objectName);
-
- if (s3Settings.UseCustomCNAME)
- {
- string url;
-
- if (!string.IsNullOrEmpty(s3Settings.CustomDomain))
- {
- url = URLHelpers.CombineURL(s3Settings.CustomDomain, objectName);
- }
- else
- {
- url = URLHelpers.CombineURL(s3Settings.Bucket, objectName);
- }
-
- return URLHelpers.FixPrefix(url);
- }
-
- return URLHelpers.CombineURL(GetEndpoint(), objectName);
- }
-
- public string GetURL(string fileName)
- {
- return GetObjectURL(GetObjectKey(fileName));
- }
-
- public string GetMd5Hash(Stream stream)
- {
- stream.Seek(0, SeekOrigin.Begin);
- using (MD5 md5 = MD5.Create())
- {
- return string.Concat(md5.ComputeHash(stream).Select(b => b.ToString("x2")));
- }
- }
-
- public override UploadResult Upload(Stream stream, string fileName)
- {
- if (string.IsNullOrEmpty(s3Settings.AccessKeyID)) Errors.Add("'Access Key' must not be empty.");
- if (string.IsNullOrEmpty(s3Settings.SecretAccessKey)) Errors.Add("'Secret Access Key' must not be empty.");
- if (string.IsNullOrEmpty(s3Settings.Bucket)) Errors.Add("'Bucket' must not be empty.");
- if (GetCurrentRegion(s3Settings) == UnknownEndpoint) Errors.Add("Please select an endpoint.");
-
- if (IsError)
- {
- return null;
- }
-
- AmazonS3Region region = GetCurrentRegion(s3Settings);
-
- AmazonS3Config s3ClientConfig = new AmazonS3Config();
-
- if (region.AmazonRegion == null)
- {
- s3ClientConfig.ServiceURL = URLHelpers.ForcePrefix(region.Hostname);
- }
- else
- {
- s3ClientConfig.RegionEndpoint = region.AmazonRegion;
- }
-
- using (AmazonS3Client client = new AmazonS3Client(GetCurrentCredentials(), s3ClientConfig))
- {
- GetPreSignedUrlRequest putRequest = new GetPreSignedUrlRequest
- {
- BucketName = s3Settings.Bucket,
- Key = GetObjectKey(fileName),
- Verb = HttpVerb.PUT,
- Expires = DateTime.UtcNow.AddMinutes(5),
- ContentType = Helpers.GetMimeType(fileName)
- };
-
- NameValueCollection requestHeaders = new NameValueCollection();
- requestHeaders["x-amz-acl"] = "public-read";
- requestHeaders["x-amz-storage-class"] = GetObjectStorageClass();
-
- putRequest.Headers["x-amz-acl"] = "public-read";
- putRequest.Headers["x-amz-storage-class"] = GetObjectStorageClass();
-
- NameValueCollection responseHeaders = SendRequestGetHeaders(HttpMethod.PUT, client.GetPreSignedURL(putRequest), stream, Helpers.GetMimeType(fileName), null, requestHeaders);
- if (responseHeaders == null || responseHeaders.Count == 0)
- {
- Errors.Add("Upload to Amazon S3 failed. Check your access credentials.");
- return null;
- }
-
- string eTag = responseHeaders.Get("ETag");
- if (eTag == null)
- {
- Errors.Add("Upload to Amazon S3 failed.");
- return null;
- }
-
- if (GetMd5Hash(stream) == eTag.Replace("\"", ""))
- {
- return new UploadResult { IsSuccess = true, URL = GetObjectURL(putRequest.Key) };
- }
-
- Errors.Add("Upload to Amazon S3 failed, uploaded data did not match.");
- return null;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/ShareX.UploadersLib/FileUploaders/AmazonS3Region.cs b/ShareX.UploadersLib/FileUploaders/AmazonS3Region.cs
deleted file mode 100644
index 87654a02d..000000000
--- a/ShareX.UploadersLib/FileUploaders/AmazonS3Region.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-#region License Information (GPL v3)
-
-/*
- ShareX - A program that allows you to take screenshots and share any file type
- Copyright (c) 2007-2017 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 .
-*/
-
-#endregion License Information (GPL v3)
-
-using Amazon;
-
-namespace ShareX.UploadersLib.FileUploaders
-{
- public class AmazonS3Region
- {
- public AmazonS3Region(string name)
- {
- Name = name;
- }
-
- public AmazonS3Region(string name, string identifier, string hostname)
- {
- Name = name;
- Identifier = identifier;
- Hostname = hostname;
- }
-
- public AmazonS3Region(RegionEndpoint region)
- {
- Name = region.DisplayName;
- Identifier = region.SystemName;
- AmazonRegion = region;
- Hostname = region.GetEndpointForService("s3").Hostname;
- }
-
- public string Name { get; private set; }
- public string Identifier { get; private set; }
- public RegionEndpoint AmazonRegion { get; private set; }
- public string Hostname { get; private set; }
- }
-}
\ No newline at end of file
diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs
index e7b3e8f48..63d292801 100644
--- a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs
+++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs
@@ -523,8 +523,8 @@ public void LoadSettings()
txtAmazonS3CustomDomain.Text = Config.AmazonS3Settings.CustomDomain;
cbAmazonS3UseRRS.Checked = Config.AmazonS3Settings.UseReducedRedundancyStorage;
- cbAmazonS3Endpoint.Items.AddRange(AmazonS3.RegionEndpoints.ToArray());
- cbAmazonS3Endpoint.SelectedItem = AmazonS3.GetCurrentRegion(Config.AmazonS3Settings);
+ //cbAmazonS3Endpoint.Items.AddRange(AmazonS3.RegionEndpoints.ToArray());
+ //cbAmazonS3Endpoint.SelectedItem = AmazonS3.GetCurrentRegion(Config.AmazonS3Settings);
cbAmazonS3Endpoint.DisplayMember = "Name";
UpdateAmazonS3Status();
@@ -1977,12 +1977,12 @@ private void txtAmazonS3SecretKey_TextChanged(object sender, EventArgs e)
private void cbAmazonS3Endpoint_SelectionChangeCommitted(object sender, EventArgs e)
{
- AmazonS3Region region = cbAmazonS3Endpoint.SelectedItem as AmazonS3Region;
+ /*AmazonS3Region region = cbAmazonS3Endpoint.SelectedItem as AmazonS3Region;
if (region != null)
{
Config.AmazonS3Settings.Endpoint = region.Identifier;
UpdateAmazonS3Status();
- }
+ }*/
}
private void txtAmazonS3BucketName_TextChanged(object sender, EventArgs e)
diff --git a/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs b/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs
index c1d59d467..e12191991 100644
--- a/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs
+++ b/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs
@@ -528,7 +528,7 @@ private void UpdateDropboxStatus()
private void UpdateAmazonS3Status()
{
- lblAmazonS3PathPreview.Text = new AmazonS3(Config.AmazonS3Settings).GetURL("Example.png");
+ //lblAmazonS3PathPreview.Text = new AmazonS3(Config.AmazonS3Settings).GetURL("Example.png");
}
#endregion Amazon S3
diff --git a/ShareX.UploadersLib/ShareX.UploadersLib.csproj b/ShareX.UploadersLib/ShareX.UploadersLib.csproj
index b93b2af71..f9f0b4635 100644
--- a/ShareX.UploadersLib/ShareX.UploadersLib.csproj
+++ b/ShareX.UploadersLib/ShareX.UploadersLib.csproj
@@ -78,14 +78,6 @@
MinimumRecommendedRules.ruleset
-
- ..\packages\AWSSDK.Core.3.3.8.1\lib\net35\AWSSDK.Core.dll
- True
-
-
- ..\packages\AWSSDK.S3.3.3.5.6\lib\net35\AWSSDK.S3.dll
- True
-
..\packages\MegaApiClient.1.3.1\lib\net40\MegaApiClient.dll
True
@@ -122,7 +114,6 @@
-
@@ -137,7 +128,6 @@
-
@@ -887,9 +877,6 @@
-
-
-
diff --git a/ShareX.UploadersLib/packages.config b/ShareX.UploadersLib/packages.config
index fecf99735..a21a28d1d 100644
--- a/ShareX.UploadersLib/packages.config
+++ b/ShareX.UploadersLib/packages.config
@@ -1,7 +1,5 @@
-
-
diff --git a/ShareX.sln b/ShareX.sln
index f1eee5ca4..6e467246f 100644
--- a/ShareX.sln
+++ b/ShareX.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShareX", "ShareX\ShareX.csproj", "{C5AE4585-E9EC-4FA3-B75A-E1210635ACB6}"
ProjectSection(ProjectDependencies) = postProject