mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 05:53:27 -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
|
@ -95,14 +95,14 @@ namespace Confluence {
|
|||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluenceConnector));
|
||||
private const string AUTH_FAILED_EXCEPTION_NAME = "com.atlassian.confluence.rpc.AuthenticationFailedException";
|
||||
private const string V2_FAILED = "AXIS";
|
||||
private static ConfluenceConfiguration config = IniConfig.GetIniSection<ConfluenceConfiguration>();
|
||||
private static readonly ConfluenceConfiguration config = IniConfig.GetIniSection<ConfluenceConfiguration>();
|
||||
private string credentials = null;
|
||||
private DateTime loggedInTime = DateTime.Now;
|
||||
private bool loggedIn = false;
|
||||
private ConfluenceSoapServiceService confluence;
|
||||
private int timeout;
|
||||
private readonly int timeout;
|
||||
private string url;
|
||||
private Cache<string, RemotePage> pageCache = new Cache<string, RemotePage>(60 * config.Timeout);
|
||||
private readonly Cache<string, RemotePage> pageCache = new Cache<string, RemotePage>(60 * config.Timeout);
|
||||
|
||||
public void Dispose() {
|
||||
Dispose(true);
|
||||
|
@ -143,9 +143,9 @@ namespace Confluence {
|
|||
/// <returns>true if login was done sucessfully</returns>
|
||||
private bool doLogin(string user, string password) {
|
||||
try {
|
||||
this.credentials = confluence.login(user, password);
|
||||
this.loggedInTime = DateTime.Now;
|
||||
this.loggedIn = true;
|
||||
credentials = confluence.login(user, password);
|
||||
loggedInTime = DateTime.Now;
|
||||
loggedIn = true;
|
||||
} catch (Exception e) {
|
||||
// Check if confluence-v2 caused an error, use v1 instead
|
||||
if (e.Message.Contains(V2_FAILED) && url.Contains("v2")) {
|
||||
|
@ -157,8 +157,8 @@ namespace Confluence {
|
|||
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;
|
||||
|
|
|
@ -36,11 +36,11 @@ namespace GreenshotConfluencePlugin {
|
|||
/// Description of ConfluenceDestination.
|
||||
/// </summary>
|
||||
public class ConfluenceDestination : AbstractDestination {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluenceDestination));
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluenceDestination));
|
||||
private static readonly ConfluenceConfiguration config = IniConfig.GetIniSection<ConfluenceConfiguration>();
|
||||
private static readonly CoreConfiguration coreConfig = IniConfig.GetIniSection<CoreConfiguration>();
|
||||
private static Image confluenceIcon = null;
|
||||
private Confluence.Page page;
|
||||
private static readonly Image confluenceIcon = null;
|
||||
private readonly Page page;
|
||||
public static bool IsInitialized {
|
||||
get;
|
||||
private set;
|
||||
|
@ -63,7 +63,7 @@ namespace GreenshotConfluencePlugin {
|
|||
public ConfluenceDestination() {
|
||||
}
|
||||
|
||||
public ConfluenceDestination(Confluence.Page page) {
|
||||
public ConfluenceDestination(Page page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
|
@ -105,17 +105,17 @@ namespace GreenshotConfluencePlugin {
|
|||
if (ConfluencePlugin.ConfluenceConnectorNoLogin == null || !ConfluencePlugin.ConfluenceConnectorNoLogin.isLoggedIn) {
|
||||
yield break;
|
||||
}
|
||||
List<Confluence.Page> currentPages = ConfluenceUtils.GetCurrentPages();
|
||||
List<Page> currentPages = ConfluenceUtils.GetCurrentPages();
|
||||
if (currentPages == null || currentPages.Count == 0) {
|
||||
yield break;
|
||||
}
|
||||
foreach(Confluence.Page currentPage in currentPages) {
|
||||
foreach(Page currentPage in currentPages) {
|
||||
yield return new ConfluenceDestination(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
|
||||
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
|
||||
ExportInformation exportInformation = new ExportInformation(Designation, Description);
|
||||
// force password check to take place before the pages load
|
||||
if (!ConfluencePlugin.ConfluenceConnector.isLoggedIn) {
|
||||
return exportInformation;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Automation;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace GreenshotConfluencePlugin {
|
|||
}
|
||||
|
||||
public EnumDisplayer(Type type) {
|
||||
this.Type = type;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public Type Type {
|
||||
|
@ -49,15 +49,15 @@ namespace GreenshotConfluencePlugin {
|
|||
if (!value.IsEnum) {
|
||||
throw new ArgumentException("parameter is not an Enumerated type", "value");
|
||||
}
|
||||
this.type = value;
|
||||
type = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<string> DisplayNames {
|
||||
get {
|
||||
this.reverseValues = (IDictionary) Activator.CreateInstance(typeof(Dictionary<,>).GetGenericTypeDefinition().MakeGenericType(typeof(string),type));
|
||||
reverseValues = (IDictionary) Activator.CreateInstance(typeof(Dictionary<,>).GetGenericTypeDefinition().MakeGenericType(typeof(string),type));
|
||||
|
||||
this.displayValues = (IDictionary)Activator.CreateInstance(typeof(Dictionary<,>).GetGenericTypeDefinition().MakeGenericType(type, typeof(string)));
|
||||
displayValues = (IDictionary)Activator.CreateInstance(typeof(Dictionary<,>).GetGenericTypeDefinition().MakeGenericType(type, typeof(string)));
|
||||
|
||||
var fields = type.GetFields(BindingFlags.Public | BindingFlags.Static);
|
||||
foreach (var field in fields) {
|
||||
|
|
|
@ -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 System.Windows;
|
||||
|
||||
namespace GreenshotConfluencePlugin {
|
||||
|
@ -26,7 +26,7 @@ namespace GreenshotConfluencePlugin {
|
|||
/// Interaction logic for ConfluenceConfigurationForm.xaml
|
||||
/// </summary>
|
||||
public partial class ConfluenceConfigurationForm : Window {
|
||||
private ConfluenceConfiguration config;
|
||||
private readonly ConfluenceConfiguration config;
|
||||
public ConfluenceConfiguration Config {
|
||||
get {
|
||||
return config;
|
||||
|
@ -34,7 +34,7 @@ namespace GreenshotConfluencePlugin {
|
|||
}
|
||||
|
||||
public ConfluenceConfigurationForm(ConfluenceConfiguration config) {
|
||||
this.DataContext = config;
|
||||
DataContext = config;
|
||||
this.config = config;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
|
|
@ -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 Confluence;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -28,11 +28,11 @@ namespace GreenshotConfluencePlugin {
|
|||
/// </summary>
|
||||
public partial class ConfluencePagePicker : System.Windows.Controls.Page {
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluencePagePicker));
|
||||
private ConfluenceUpload confluenceUpload = null;
|
||||
private readonly ConfluenceUpload confluenceUpload = null;
|
||||
|
||||
public ConfluencePagePicker(ConfluenceUpload confluenceUpload, List<Page> pagesToPick) {
|
||||
this.confluenceUpload = confluenceUpload;
|
||||
this.DataContext = pagesToPick;
|
||||
DataContext = pagesToPick;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,20 +18,17 @@
|
|||
* 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.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
|
||||
using Confluence;
|
||||
using GreenshotPlugin.Core;
|
||||
using Greenshot.IniFile;
|
||||
|
||||
namespace GreenshotConfluencePlugin {
|
||||
public partial class ConfluenceSearch : System.Windows.Controls.Page {
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluenceSearch));
|
||||
private static ConfluenceConfiguration config = IniConfig.GetIniSection<ConfluenceConfiguration>();
|
||||
private ConfluenceUpload confluenceUpload;
|
||||
private static readonly ConfluenceConfiguration config = IniConfig.GetIniSection<ConfluenceConfiguration>();
|
||||
private readonly ConfluenceUpload confluenceUpload;
|
||||
|
||||
public List<Confluence.Space> Spaces {
|
||||
get {
|
||||
|
@ -39,7 +36,7 @@ namespace GreenshotConfluencePlugin {
|
|||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<Confluence.Page> pages = new ObservableCollection<Confluence.Page>();
|
||||
private readonly ObservableCollection<Confluence.Page> pages = new ObservableCollection<Confluence.Page>();
|
||||
public ObservableCollection<Confluence.Page> Pages {
|
||||
get {
|
||||
return pages;
|
||||
|
@ -48,14 +45,14 @@ namespace GreenshotConfluencePlugin {
|
|||
|
||||
public ConfluenceSearch(ConfluenceUpload confluenceUpload) {
|
||||
this.confluenceUpload = confluenceUpload;
|
||||
this.DataContext = this;
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
if (config.SearchSpaceKey == null) {
|
||||
this.SpaceComboBox.SelectedItem = Spaces[0];
|
||||
SpaceComboBox.SelectedItem = Spaces[0];
|
||||
} else {
|
||||
foreach(Confluence.Space space in Spaces) {
|
||||
if (space.Key.Equals(config.SearchSpaceKey)) {
|
||||
this.SpaceComboBox.SelectedItem = space;
|
||||
SpaceComboBox.SelectedItem = space;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +91,7 @@ namespace GreenshotConfluencePlugin {
|
|||
}
|
||||
}
|
||||
|
||||
void Page_Loaded(object sender, System.Windows.RoutedEventArgs e) {
|
||||
void Page_Loaded(object sender, RoutedEventArgs e) {
|
||||
SelectionChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ using System.Windows.Input;
|
|||
using System.Windows.Threading;
|
||||
|
||||
using Confluence;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace GreenshotConfluencePlugin {
|
||||
/// <summary>
|
||||
|
@ -35,12 +34,12 @@ namespace GreenshotConfluencePlugin {
|
|||
/// </summary>
|
||||
public partial class ConfluenceTreePicker : System.Windows.Controls.Page {
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ConfluenceTreePicker));
|
||||
private ConfluenceConnector confluenceConnector;
|
||||
private ConfluenceUpload confluenceUpload;
|
||||
private readonly ConfluenceConnector confluenceConnector;
|
||||
private readonly ConfluenceUpload confluenceUpload;
|
||||
private bool isInitDone = false;
|
||||
|
||||
public ConfluenceTreePicker(ConfluenceUpload confluenceUpload) {
|
||||
this.confluenceConnector = ConfluencePlugin.ConfluenceConnector;
|
||||
confluenceConnector = ConfluencePlugin.ConfluenceConnector;
|
||||
this.confluenceUpload = confluenceUpload;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
|
|
@ -100,12 +100,12 @@ namespace GreenshotConfluencePlugin {
|
|||
}
|
||||
|
||||
public ConfluenceUpload(string filename) {
|
||||
this.Filename = filename;
|
||||
Filename = filename;
|
||||
InitializeComponent();
|
||||
this.DataContext = this;
|
||||
updateSpaces();
|
||||
if (PickerPage == null) {
|
||||
PickerTab.Visibility = System.Windows.Visibility.Collapsed;
|
||||
PickerTab.Visibility = Visibility.Collapsed;
|
||||
SearchTab.IsSelected = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace TranslationByMarkupExtension {
|
||||
namespace TranslationByMarkupExtension {
|
||||
public interface ITranslationProvider {
|
||||
/// <summary>
|
||||
/// Translates the specified key.
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
using GreenshotConfluencePlugin;
|
||||
using GreenshotPlugin.Core;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace TranslationByMarkupExtension {
|
||||
/// <summary>
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace TranslationByMarkupExtension {
|
|||
public class TranslationData : IWeakEventListener, INotifyPropertyChanged {
|
||||
#region Private Members
|
||||
|
||||
private string _key;
|
||||
private readonly string _key;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace TranslationByMarkupExtension {
|
||||
public class TranslationManager {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue