mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
First code analysis changes, this "should" make Greenshot more stable and implement things as is supposed.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2481 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
3f4d93f2b6
commit
a394904aa3
64 changed files with 514 additions and 343 deletions
|
@ -91,7 +91,7 @@ namespace Confluence {
|
|||
}
|
||||
#endregion
|
||||
|
||||
public class ConfluenceConnector {
|
||||
public class ConfluenceConnector : IDisposable {
|
||||
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";
|
||||
|
@ -104,6 +104,23 @@ namespace Confluence {
|
|||
private string url;
|
||||
private Cache<string, RemotePage> pageCache = new Cache<string, RemotePage>(60 * config.Timeout);
|
||||
|
||||
public void Dispose() {
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing) {
|
||||
if (confluence != null) {
|
||||
logout();
|
||||
}
|
||||
if (disposing) {
|
||||
if (confluence != null) {
|
||||
confluence.Dispose();
|
||||
confluence = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ConfluenceConnector(string url, int timeout) {
|
||||
this.timeout = timeout;
|
||||
init(url);
|
||||
|
@ -117,7 +134,7 @@ namespace Confluence {
|
|||
}
|
||||
|
||||
~ConfluenceConnector() {
|
||||
logout();
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -39,6 +39,15 @@ namespace GreenshotConfluencePlugin {
|
|||
private static ConfluenceConfiguration config = null;
|
||||
private static IGreenshotHost host;
|
||||
|
||||
public void Dispose() {
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing) {
|
||||
//if (disposing) {}
|
||||
}
|
||||
|
||||
private static void CreateConfluenceConntector() {
|
||||
if (confluenceConnector == null) {
|
||||
if (config.Url.Contains("soap-axis")) {
|
||||
|
|
|
@ -31,7 +31,6 @@ 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 ConfluenceConnector confluenceConnector;
|
||||
private ConfluenceUpload confluenceUpload;
|
||||
|
||||
public List<Confluence.Space> Spaces {
|
||||
|
@ -48,7 +47,6 @@ namespace GreenshotConfluencePlugin {
|
|||
}
|
||||
|
||||
public ConfluenceSearch(ConfluenceUpload confluenceUpload) {
|
||||
this.confluenceConnector = ConfluencePlugin.ConfluenceConnector;
|
||||
this.confluenceUpload = confluenceUpload;
|
||||
this.DataContext = this;
|
||||
InitializeComponent();
|
||||
|
@ -81,7 +79,7 @@ namespace GreenshotConfluencePlugin {
|
|||
void doSearch() {
|
||||
string spaceKey = (string)SpaceComboBox.SelectedValue;
|
||||
config.SearchSpaceKey = spaceKey;
|
||||
List<Confluence.Page> searchResult = confluenceConnector.searchPages(searchText.Text, spaceKey);
|
||||
List<Confluence.Page> searchResult = ConfluencePlugin.ConfluenceConnector.searchPages(searchText.Text, spaceKey);
|
||||
pages.Clear();
|
||||
foreach(Confluence.Page page in searchResult) {
|
||||
pages.Add(page);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue