mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 18:57:28 -07:00
FEATURE-945: Added environment variables to the external command (also removed unused imports and made some variables readonly)
This commit is contained in:
parent
4f326c9c0e
commit
d25021631e
90 changed files with 390 additions and 373 deletions
|
@ -29,21 +29,21 @@ using Jira;
|
|||
|
||||
namespace GreenshotJiraPlugin {
|
||||
public partial class JiraForm : Form {
|
||||
private JiraConnector jiraConnector;
|
||||
private readonly JiraConnector jiraConnector;
|
||||
private JiraIssue selectedIssue;
|
||||
private GreenshotColumnSorter columnSorter;
|
||||
private JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
private readonly GreenshotColumnSorter columnSorter;
|
||||
private readonly JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
|
||||
public JiraForm(JiraConnector jiraConnector) {
|
||||
InitializeComponent();
|
||||
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
|
||||
Icon = GreenshotResources.getGreenshotIcon();
|
||||
AcceptButton = uploadButton;
|
||||
CancelButton = cancelButton;
|
||||
|
||||
initializeComponentText();
|
||||
|
||||
this.columnSorter = new GreenshotColumnSorter();
|
||||
this.jiraListView.ListViewItemSorter = columnSorter;
|
||||
columnSorter = new GreenshotColumnSorter();
|
||||
jiraListView.ListViewItemSorter = columnSorter;
|
||||
|
||||
this.jiraConnector = jiraConnector;
|
||||
|
||||
|
@ -60,9 +60,9 @@ namespace GreenshotJiraPlugin {
|
|||
}
|
||||
|
||||
private void initializeComponentText() {
|
||||
this.label_jirafilter.Text = Language.GetString("jira", LangKey.label_jirafilter);
|
||||
this.label_comment.Text = Language.GetString("jira", LangKey.label_comment);
|
||||
this.label_filename.Text = Language.GetString("jira", LangKey.label_filename);
|
||||
label_jirafilter.Text = Language.GetString("jira", LangKey.label_jirafilter);
|
||||
label_comment.Text = Language.GetString("jira", LangKey.label_comment);
|
||||
label_filename.Text = Language.GetString("jira", LangKey.label_filename);
|
||||
}
|
||||
|
||||
private void updateForm() {
|
||||
|
@ -188,7 +188,7 @@ namespace GreenshotJiraPlugin {
|
|||
}
|
||||
|
||||
// Perform the sort with these new sort options.
|
||||
this.jiraListView.Sort();
|
||||
jiraListView.Sort();
|
||||
}
|
||||
|
||||
void JiraKeyTextChanged(object sender, EventArgs e) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
|
||||
using GreenshotPlugin.Controls;
|
||||
|
||||
namespace GreenshotJiraPlugin {
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace GreenshotJiraPlugin {
|
||||
/// <summary>
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace Jira {
|
|||
#region transport classes
|
||||
public class JiraFilter {
|
||||
public JiraFilter(string name, string id) {
|
||||
this.Name = name;
|
||||
this.Id = id;
|
||||
Name = name;
|
||||
Id = id;
|
||||
}
|
||||
public string Name {
|
||||
get;
|
||||
|
@ -48,15 +48,15 @@ namespace Jira {
|
|||
|
||||
public class JiraIssue {
|
||||
public JiraIssue(string key, DateTime? created, string reporter, string assignee, string project, string summary, string description, string environment, string [] attachmentNames) {
|
||||
this.Key = key;
|
||||
this.Created = created;
|
||||
this.Reporter = reporter;
|
||||
this.Assignee = assignee;
|
||||
this.Project = project;
|
||||
this.Summary = summary;
|
||||
this.Description = description;
|
||||
this.Environment = environment;
|
||||
this.AttachmentNames = attachmentNames;
|
||||
Key = key;
|
||||
Created = created;
|
||||
Reporter = reporter;
|
||||
Assignee = assignee;
|
||||
Project = project;
|
||||
Summary = summary;
|
||||
Description = description;
|
||||
Environment = environment;
|
||||
AttachmentNames = attachmentNames;
|
||||
}
|
||||
public string Key {
|
||||
get;
|
||||
|
@ -100,17 +100,17 @@ namespace Jira {
|
|||
public class JiraConnector : IDisposable {
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(JiraConnector));
|
||||
private const string AUTH_FAILED_EXCEPTION_NAME = "com.atlassian.jira.rpc.exception.RemoteAuthenticationException";
|
||||
private static JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
private static readonly JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
public const string DEFAULT_POSTFIX = "/rpc/soap/jirasoapservice-v2?wsdl";
|
||||
private string credentials;
|
||||
private DateTime loggedInTime = DateTime.Now;
|
||||
private bool loggedIn;
|
||||
private JiraSoapServiceService jira;
|
||||
private int timeout;
|
||||
private readonly int timeout;
|
||||
private string url;
|
||||
private Cache<string, JiraIssue> jiraCache = new Cache<string, JiraIssue>(60 * config.Timeout);
|
||||
private Cache<string, RemoteUser> userCache = new Cache<string, RemoteUser>(60 * config.Timeout);
|
||||
private bool suppressBackgroundForm = false;
|
||||
private readonly Cache<string, JiraIssue> jiraCache = new Cache<string, JiraIssue>(60 * config.Timeout);
|
||||
private readonly Cache<string, RemoteUser> userCache = new Cache<string, RemoteUser>(60 * config.Timeout);
|
||||
private readonly bool suppressBackgroundForm = false;
|
||||
|
||||
public void Dispose() {
|
||||
Dispose(true);
|
||||
|
@ -134,8 +134,8 @@ namespace Jira {
|
|||
}
|
||||
|
||||
public JiraConnector(bool suppressBackgroundForm) {
|
||||
this.url = config.Url;
|
||||
this.timeout = config.Timeout;
|
||||
url = config.Url;
|
||||
timeout = config.Timeout;
|
||||
this.suppressBackgroundForm = suppressBackgroundForm;
|
||||
createService();
|
||||
}
|
||||
|
@ -171,13 +171,13 @@ namespace Jira {
|
|||
ThreadStart jiraLogin = delegate {
|
||||
LOG.DebugFormat("Loggin in");
|
||||
try {
|
||||
this.credentials = jira.login(user, password);
|
||||
credentials = jira.login(user, password);
|
||||
} catch (Exception) {
|
||||
if (!url.EndsWith("wsdl")) {
|
||||
url = url + "/rpc/soap/jirasoapservice-v2?wsdl";
|
||||
// recreate the service with the new url
|
||||
createService();
|
||||
this.credentials = jira.login(user, password);
|
||||
credentials = jira.login(user, password);
|
||||
// Worked, store the url in the configuration
|
||||
config.Url = url;
|
||||
IniConfig.Save();
|
||||
|
@ -187,8 +187,8 @@ namespace Jira {
|
|||
}
|
||||
|
||||
LOG.DebugFormat("Logged in");
|
||||
this.loggedInTime = DateTime.Now;
|
||||
this.loggedIn = true;
|
||||
loggedInTime = DateTime.Now;
|
||||
loggedIn = true;
|
||||
|
||||
};
|
||||
// Here we do it
|
||||
|
@ -204,8 +204,8 @@ namespace Jira {
|
|||
return false;
|
||||
}
|
||||
// Not an authentication issue
|
||||
this.loggedIn = false;
|
||||
this.credentials = null;
|
||||
loggedIn = false;
|
||||
credentials = null;
|
||||
e.Data.Add("user", user);
|
||||
e.Data.Add("url", url);
|
||||
throw;
|
||||
|
|
|
@ -35,10 +35,10 @@ namespace GreenshotJiraPlugin {
|
|||
/// Description of JiraDestination.
|
||||
/// </summary>
|
||||
public class JiraDestination : AbstractDestination {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(JiraDestination));
|
||||
private static JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
private JiraPlugin jiraPlugin = null;
|
||||
private JiraIssue jira = null;
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(JiraDestination));
|
||||
private static readonly JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
private readonly JiraPlugin jiraPlugin = null;
|
||||
private readonly JiraIssue jira = null;
|
||||
|
||||
public JiraDestination(JiraPlugin jiraPlugin) {
|
||||
this.jiraPlugin = jiraPlugin;
|
||||
|
@ -100,7 +100,7 @@ namespace GreenshotJiraPlugin {
|
|||
}
|
||||
|
||||
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surfaceToUpload, ICaptureDetails captureDetails) {
|
||||
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
|
||||
ExportInformation exportInformation = new ExportInformation(Designation, Description);
|
||||
string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails));
|
||||
SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
|
||||
if (jira != null) {
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace GreenshotJiraPlugin {
|
|||
/// <param name="pluginAttribute">My own attributes</param>
|
||||
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
|
||||
public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
|
||||
this.host = (IGreenshotHost)pluginHost;
|
||||
host = (IGreenshotHost)pluginHost;
|
||||
jiraPluginAttributes = myAttributes;
|
||||
|
||||
// Register configuration (don't need the configuration itself)
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace GreenshotJiraPlugin {
|
|||
/// </summary>
|
||||
public class JiraUtils {
|
||||
private static readonly Regex JIRA_KEY_REGEX = new Regex(@"/browse/([A-Z0-9]+\-[0-9]+)");
|
||||
private static JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
private static readonly JiraConfiguration config = IniConfig.GetIniSection<JiraConfiguration>();
|
||||
|
||||
public static List<JiraIssue> GetCurrentJiras() {
|
||||
// Make sure we suppress the login
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
using Greenshot.Plugin;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue