fixed #501: Lambda destination disable if api key missing

This commit is contained in:
Jaex 2015-02-11 21:02:51 +02:00
parent 3d4d23903b
commit c4f4efc533
4 changed files with 17 additions and 2 deletions

View file

@ -24,6 +24,7 @@
#endregion License Information (GPL v3)
using Newtonsoft.Json;
using ShareX.UploadersLib.Properties;
using System.Collections.Generic;
using System.IO;
@ -45,7 +46,7 @@ public override UploadResult Upload(Stream stream, string fileName)
{
if (string.IsNullOrEmpty(Config.UserAPIKey))
{
Errors.Add("Missing API key. Set one in destination settings.");
Errors.Add(Resources.Lambda_Upload_Missing_API_key__Set_one_in_destination_settings_);
return null;
}

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.0
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -421,6 +421,15 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Missing API key. Set one in destination settings..
/// </summary>
internal static string Lambda_Upload_Missing_API_key__Set_one_in_destination_settings_ {
get {
return ResourceManager.GetString("Lambda_Upload_Missing_API_key__Set_one_in_destination_settings_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -472,4 +472,7 @@ Created folders:</value>
<data name="Hubic" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Favicons\hubic.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Lambda_Upload_Missing_API_key__Set_one_in_destination_settings_" xml:space="preserve">
<value>Missing API key. Set one in destination settings.</value>
</data>
</root>

View file

@ -414,6 +414,8 @@ public bool IsValid(FileDestination destination)
return !string.IsNullOrEmpty(OwnCloudHost) && !string.IsNullOrEmpty(OwnCloudUsername) && !string.IsNullOrEmpty(OwnCloudPassword);
case FileDestination.MediaFire:
return !string.IsNullOrEmpty(MediaFireUsername) && !string.IsNullOrEmpty(MediaFirePassword);
case FileDestination.Lambda:
return LambdaSettings != null && !string.IsNullOrEmpty(LambdaSettings.UserAPIKey);
}
return true;