BUG-2079: Small changes for the bug, to help to track the issue. [skip ci]

This commit is contained in:
Robin 2016-12-26 20:32:06 +01:00
commit 4f289d838a
3 changed files with 34 additions and 7 deletions

View file

@ -159,6 +159,7 @@ namespace GreenshotJiraPlugin {
_loggedInTime = DateTime.Now; _loggedInTime = DateTime.Now;
return; return;
} }
// Login failed, confirm this
try { try {
credentialsDialog.Confirm(false); credentialsDialog.Confirm(false);
} catch (ApplicationException e) { } catch (ApplicationException e) {

View file

@ -27,13 +27,14 @@ using System.Threading.Tasks;
using Dapplo.Log.Facade; using Dapplo.Log.Facade;
using GreenshotJiraPlugin.Forms; using GreenshotJiraPlugin.Forms;
using GreenshotPlugin.Core; using GreenshotPlugin.Core;
using log4net;
namespace GreenshotJiraPlugin { namespace GreenshotJiraPlugin {
/// <summary> /// <summary>
/// This is the JiraPlugin base code /// This is the JiraPlugin base code
/// </summary> /// </summary>
public class JiraPlugin : IGreenshotPlugin { public class JiraPlugin : IGreenshotPlugin {
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(JiraPlugin)); private static readonly ILog Log = LogManager.GetLogger(typeof(JiraPlugin));
private JiraConfiguration _config; private JiraConfiguration _config;
private static JiraPlugin _instance; private static JiraPlugin _instance;
private JiraConnector _jiraConnector; private JiraConnector _jiraConnector;
@ -94,7 +95,32 @@ namespace GreenshotJiraPlugin {
public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
// Register configuration (don't need the configuration itself) // Register configuration (don't need the configuration itself)
_config = IniConfig.GetIniSection<JiraConfiguration>(); _config = IniConfig.GetIniSection<JiraConfiguration>();
LogSettings.RegisterDefaultLogger<Log4NetLogger>();
// Make sure the loggin is enable for the corect level.
if (Log.IsDebugEnabled)
{
LogSettings.RegisterDefaultLogger<Log4NetLogger>(LogLevels.Verbose);
}
else if (Log.IsInfoEnabled)
{
LogSettings.RegisterDefaultLogger<Log4NetLogger>(LogLevels.Info);
}
else if (Log.IsWarnEnabled)
{
LogSettings.RegisterDefaultLogger<Log4NetLogger>(LogLevels.Warn);
}
else if (Log.IsErrorEnabled)
{
LogSettings.RegisterDefaultLogger<Log4NetLogger>(LogLevels.Error);
}
else if (Log.IsErrorEnabled)
{
LogSettings.RegisterDefaultLogger<Log4NetLogger>(LogLevels.Error);
}
else
{
LogSettings.RegisterDefaultLogger<Log4NetLogger>(LogLevels.Fatal);
}
// Add a SVG converter, although it doesn't fit to the Jira plugin there is currently no other way // Add a SVG converter, although it doesn't fit to the Jira plugin there is currently no other way
ImageHelper.StreamConverters["svg"] = (stream, s) => ImageHelper.StreamConverters["svg"] = (stream, s) =>

View file

@ -322,17 +322,17 @@ namespace GreenshotPlugin.Core {
/// <summary>Confirmation action to be applied.</summary> /// <summary>Confirmation action to be applied.</summary>
/// <param name="value">True if the credentials should be persisted.</param> /// <param name="value">True if the credentials should be persisted.</param>
public void Confirm(bool value) { public void Confirm(bool value)
switch (CredUi.CredUIConfirmCredentials(Target, value)) { {
var confirmResult = CredUi.CredUIConfirmCredentials(Target, value);
switch (confirmResult) {
case CredUi.ReturnCodes.NO_ERROR: case CredUi.ReturnCodes.NO_ERROR:
break; break;
case CredUi.ReturnCodes.ERROR_INVALID_PARAMETER: case CredUi.ReturnCodes.ERROR_INVALID_PARAMETER:
// for some reason, this is encountered when credentials are overwritten // for some reason, this is encountered when credentials are overwritten
break; break;
default: default:
throw new ApplicationException("Credential confirmation failed."); throw new ApplicationException($"Credential confirmation failed: {confirmResult}");
} }
} }