mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
Code quality changes
This commit is contained in:
parent
f07ed83722
commit
610f45d082
189 changed files with 4609 additions and 5203 deletions
|
@ -32,19 +32,18 @@ namespace GreenshotOfficePlugin {
|
|||
/// Description of PowerpointDestination.
|
||||
/// </summary>
|
||||
public class PowerpointDestination : AbstractDestination {
|
||||
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PowerpointDestination));
|
||||
private const int ICON_APPLICATION = 0;
|
||||
private const int ICON_PRESENTATION = 1;
|
||||
private const int IconApplication = 0;
|
||||
private const int IconPresentation = 1;
|
||||
|
||||
private static readonly string exePath = null;
|
||||
private readonly string presentationName = null;
|
||||
private static readonly string ExePath;
|
||||
private readonly string _presentationName;
|
||||
|
||||
static PowerpointDestination() {
|
||||
exePath = PluginUtils.GetExePath("POWERPNT.EXE");
|
||||
if (exePath != null && File.Exists(exePath)) {
|
||||
ExePath = PluginUtils.GetExePath("POWERPNT.EXE");
|
||||
if (ExePath != null && File.Exists(ExePath)) {
|
||||
WindowDetails.AddProcessToExcludeFromFreeze("powerpnt");
|
||||
} else {
|
||||
exePath = null;
|
||||
ExePath = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,50 +51,34 @@ namespace GreenshotOfficePlugin {
|
|||
}
|
||||
|
||||
public PowerpointDestination(string presentationName) {
|
||||
this.presentationName = presentationName;
|
||||
_presentationName = presentationName;
|
||||
}
|
||||
|
||||
public override string Designation {
|
||||
get {
|
||||
return "Powerpoint";
|
||||
}
|
||||
}
|
||||
public override string Designation => "Powerpoint";
|
||||
|
||||
public override string Description {
|
||||
get {
|
||||
if (presentationName == null) {
|
||||
get
|
||||
{
|
||||
if (_presentationName == null) {
|
||||
return "Microsoft Powerpoint";
|
||||
} else {
|
||||
return presentationName;
|
||||
}
|
||||
return _presentationName;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Priority {
|
||||
get {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool isDynamic {
|
||||
get {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override int Priority => 4;
|
||||
|
||||
public override bool isActive {
|
||||
get {
|
||||
return base.isActive && exePath != null;
|
||||
}
|
||||
}
|
||||
public override bool IsDynamic => true;
|
||||
|
||||
public override bool IsActive => base.IsActive && ExePath != null;
|
||||
|
||||
public override Image DisplayIcon {
|
||||
get {
|
||||
if (!string.IsNullOrEmpty(presentationName)) {
|
||||
return PluginUtils.GetCachedExeIcon(exePath, ICON_PRESENTATION);
|
||||
if (!string.IsNullOrEmpty(_presentationName)) {
|
||||
return PluginUtils.GetCachedExeIcon(ExePath, IconPresentation);
|
||||
}
|
||||
|
||||
return PluginUtils.GetCachedExeIcon(exePath, ICON_APPLICATION);
|
||||
return PluginUtils.GetCachedExeIcon(ExePath, IconApplication);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,14 +96,13 @@ namespace GreenshotOfficePlugin {
|
|||
tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat());
|
||||
imageSize = surface.Image.Size;
|
||||
}
|
||||
if (presentationName != null) {
|
||||
exportInformation.ExportMade = PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title);
|
||||
if (_presentationName != null) {
|
||||
exportInformation.ExportMade = PowerpointExporter.ExportToPresentation(_presentationName, tmpFile, imageSize, captureDetails.Title);
|
||||
} else {
|
||||
if (!manuallyInitiated) {
|
||||
List<string> presentations = PowerpointExporter.GetPowerpointPresentations();
|
||||
var presentations = PowerpointExporter.GetPowerpointPresentations();
|
||||
if (presentations != null && presentations.Count > 0) {
|
||||
List<IDestination> destinations = new List<IDestination>();
|
||||
destinations.Add(new PowerpointDestination());
|
||||
var destinations = new List<IDestination> {new PowerpointDestination()};
|
||||
foreach (string presentation in presentations) {
|
||||
destinations.Add(new PowerpointDestination(presentation));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue