mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 05:53:27 -07:00
Code quality changes
This commit is contained in:
parent
f07ed83722
commit
610f45d082
189 changed files with 4609 additions and 5203 deletions
|
@ -21,8 +21,6 @@
|
|||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
using Greenshot.IniFile;
|
||||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
|
@ -31,10 +29,8 @@ namespace GreenshotPhotobucketPlugin {
|
|||
/// Description of PhotobucketDestination.
|
||||
/// </summary>
|
||||
public class PhotobucketDestination : AbstractDestination {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketDestination));
|
||||
private static PhotobucketConfiguration config = IniConfig.GetIniSection<PhotobucketConfiguration>();
|
||||
private readonly PhotobucketPlugin plugin = null;
|
||||
private readonly string albumPath = null;
|
||||
private readonly PhotobucketPlugin _plugin;
|
||||
private readonly string _albumPath;
|
||||
|
||||
/// <summary>
|
||||
/// Create a Photobucket destination, which also has the path to the album in it
|
||||
|
@ -42,20 +38,16 @@ namespace GreenshotPhotobucketPlugin {
|
|||
/// <param name="plugin"></param>
|
||||
/// <param name="albumPath">path to the album, null for default</param>
|
||||
public PhotobucketDestination(PhotobucketPlugin plugin, string albumPath) {
|
||||
this.plugin = plugin;
|
||||
this.albumPath = albumPath;
|
||||
_plugin = plugin;
|
||||
_albumPath = albumPath;
|
||||
}
|
||||
|
||||
public override string Designation {
|
||||
get {
|
||||
return "Photobucket";
|
||||
}
|
||||
}
|
||||
public override string Designation => "Photobucket";
|
||||
|
||||
public override string Description {
|
||||
get {
|
||||
if (albumPath != null) {
|
||||
return albumPath;
|
||||
if (_albumPath != null) {
|
||||
return _albumPath;
|
||||
}
|
||||
return Language.GetString("photobucket", LangKey.upload_menu_item);
|
||||
}
|
||||
|
@ -68,24 +60,23 @@ namespace GreenshotPhotobucketPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
public override bool isDynamic {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override bool IsDynamic => true;
|
||||
|
||||
public override IEnumerable<IDestination> DynamicDestinations() {
|
||||
List<string> albums = null;
|
||||
IList<string> albums = null;
|
||||
try {
|
||||
albums = PhotobucketUtils.RetrievePhotobucketAlbums();
|
||||
} catch {
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (albums == null || albums.Count == 0) {
|
||||
yield break;
|
||||
}
|
||||
foreach (string album in albums) {
|
||||
yield return new PhotobucketDestination(plugin, album);
|
||||
yield return new PhotobucketDestination(_plugin, album);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,11 +89,11 @@ namespace GreenshotPhotobucketPlugin {
|
|||
/// <returns></returns>
|
||||
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
|
||||
ExportInformation exportInformation = new ExportInformation(Designation, Description);
|
||||
string uploadURL = null;
|
||||
bool uploaded = plugin.Upload(captureDetails, surface, albumPath, out uploadURL);
|
||||
string uploadUrl;
|
||||
bool uploaded = _plugin.Upload(captureDetails, surface, _albumPath, out uploadUrl);
|
||||
if (uploaded) {
|
||||
exportInformation.ExportMade = true;
|
||||
exportInformation.Uri = uploadURL;
|
||||
exportInformation.Uri = uploadUrl;
|
||||
}
|
||||
ProcessExport(exportInformation, surface);
|
||||
return exportInformation;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue