Fix code indent; replace tabs

This commit is contained in:
Jan Klass 2025-07-16 00:40:44 +02:00
commit 2b2283c7c9
15 changed files with 120 additions and 120 deletions

View file

@ -35,28 +35,28 @@ namespace Greenshot.Base.Core
/// doesn't show all credentials use the tool here: https://www.microsoft.com/indonesia/msdn/credmgmt.aspx /// doesn't show all credentials use the tool here: https://www.microsoft.com/indonesia/msdn/credmgmt.aspx
/// The following code is an example for a login, it will call the Authenticate with user/password /// The following code is an example for a login, it will call the Authenticate with user/password
/// which should return true if the login worked, false if not. /// which should return true if the login worked, false if not.
/// private static bool Login(string system, string name) { /// private static bool Login(string system, string name) {
/// try { /// try {
/// CredentialsDialog dialog = new CredentialsDialog(system); /// CredentialsDialog dialog = new CredentialsDialog(system);
/// dialog.Name = name; /// dialog.Name = name;
/// while (dialog.Show(dialog.Name) == DialogResult.OK) { /// while (dialog.Show(dialog.Name) == DialogResult.OK) {
/// if (Authenticate(dialog.Name, dialog.Password)) { /// if (Authenticate(dialog.Name, dialog.Password)) {
/// if (dialog.SaveChecked) dialog.Confirm(true); /// if (dialog.SaveChecked) dialog.Confirm(true);
/// return true; /// return true;
/// } else { /// } else {
/// try { /// try {
/// dialog.Confirm(false); /// dialog.Confirm(false);
/// } catch (ApplicationException) { /// } catch (ApplicationException) {
/// // exception handling ... /// // exception handling ...
/// } /// }
/// dialog.IncorrectPassword = true; /// dialog.IncorrectPassword = true;
/// } /// }
/// } /// }
/// } catch (ApplicationException) { /// } catch (ApplicationException) {
/// // exception handling ... /// // exception handling ...
/// } /// }
/// return false; /// return false;
/// } /// }
/// </summary> /// </summary>
/// <summary>Encapsulates dialog functionality from the Credential Management API.</summary> /// <summary>Encapsulates dialog functionality from the Credential Management API.</summary>
public sealed class CredentialsDialog public sealed class CredentialsDialog

View file

@ -128,7 +128,7 @@ namespace Greenshot.Base.Core
{ {
ModifyRegistry("HKEY_CURRENT_USER", applicationName + ".exe", ieVersion); ModifyRegistry("HKEY_CURRENT_USER", applicationName + ".exe", ieVersion);
#if DEBUG #if DEBUG
ModifyRegistry("HKEY_CURRENT_USER", applicationName + ".vshost.exe", ieVersion); ModifyRegistry("HKEY_CURRENT_USER", applicationName + ".vshost.exe", ieVersion);
#endif #endif
} }

View file

@ -1171,9 +1171,9 @@ namespace Greenshot.Base.Core
/// <summary> /// <summary>
/// Clone an image, taking some rules into account: /// Clone an image, taking some rules into account:
/// 1) When sourceRect is the whole bitmap there is a GDI+ bug in Clone /// 1) When sourceRect is the whole bitmap there is a GDI+ bug in Clone
/// Clone will than return the same PixelFormat as the source /// Clone will than return the same PixelFormat as the source
/// a quick workaround is using new Bitmap which uses a default of Format32bppArgb /// a quick workaround is using new Bitmap which uses a default of Format32bppArgb
/// 2) When going from a transparent to a non transparent bitmap, we draw the background white! /// 2) When going from a transparent to a non transparent bitmap, we draw the background white!
/// </summary> /// </summary>
/// <param name="sourceImage">Source bitmap to clone</param> /// <param name="sourceImage">Source bitmap to clone</param>
/// <param name="sourceRect">NativeRect to copy from the source, use NativeRect.Empty for all</param> /// <param name="sourceRect">NativeRect to copy from the source, use NativeRect.Empty for all</param>

View file

@ -87,9 +87,9 @@ namespace Greenshot.Base.Core.OAuth
// gives as described here: https://developers.google.com/identity/protocols/OAuth2InstalledApp // gives as described here: https://developers.google.com/identity/protocols/OAuth2InstalledApp
// "access_token":"1/fFAGRNJru1FTz70BzhT3Zg", // "access_token":"1/fFAGRNJru1FTz70BzhT3Zg",
// "expires_in":3920, // "expires_in":3920,
// "token_type":"Bearer", // "token_type":"Bearer",
// "refresh_token":"1/xEoDL4iW3cxlI7yDbSRFYNG01kVKM2C-259HOF2aQbI" // "refresh_token":"1/xEoDL4iW3cxlI7yDbSRFYNG01kVKM2C-259HOF2aQbI"
if (refreshTokenResult.ContainsKey(AccessToken)) if (refreshTokenResult.ContainsKey(AccessToken))
{ {
settings.AccessToken = (string) refreshTokenResult[AccessToken]; settings.AccessToken = (string) refreshTokenResult[AccessToken];
@ -181,8 +181,8 @@ namespace Greenshot.Base.Core.OAuth
// gives as described here: https://developers.google.com/identity/protocols/OAuth2InstalledApp // gives as described here: https://developers.google.com/identity/protocols/OAuth2InstalledApp
// "access_token":"1/fFAGRNJru1FTz70BzhT3Zg", // "access_token":"1/fFAGRNJru1FTz70BzhT3Zg",
// "expires_in":3920, // "expires_in":3920,
// "token_type":"Bearer", // "token_type":"Bearer",
IDictionary<string, object> accessTokenResult = JSONHelper.JsonDecode(accessTokenJsonResult); IDictionary<string, object> accessTokenResult = JSONHelper.JsonDecode(accessTokenJsonResult);
if (accessTokenResult.ContainsKey("error")) if (accessTokenResult.ContainsKey("error"))

View file

@ -621,7 +621,7 @@ namespace Greenshot.Base.Core
} }
/// <summary> /// <summary>
/// Finds the optimal (maximal) position for the cut. /// Finds the optimal (maximal) position for the cut.
/// </summary> /// </summary>
private float Maximize(WuColorCube cube, int direction, int first, int last, int[] cut, long wholeRed, long wholeGreen, long wholeBlue, long wholeWeight) private float Maximize(WuColorCube cube, int direction, int first, int last, int[] cut, long wholeRed, long wholeGreen, long wholeBlue, long wholeWeight)
{ {

View file

@ -274,7 +274,7 @@ namespace Greenshot.Base.Core
// See https://connect.microsoft.com/VisualStudio/feedback/details/344752/gdi-object-leak-when-calling-graphics-copyfromscreen // See https://connect.microsoft.com/VisualStudio/feedback/details/344752/gdi-object-leak-when-calling-graphics-copyfromscreen
// Bitmap capturedBitmap = new Bitmap(captureBounds.Width, captureBounds.Height); // Bitmap capturedBitmap = new Bitmap(captureBounds.Width, captureBounds.Height);
// using (Graphics graphics = Graphics.FromImage(capturedBitmap)) { // using (Graphics graphics = Graphics.FromImage(capturedBitmap)) {
// graphics.CopyFromScreen(captureBounds.Location, Point.Empty, captureBounds.Size, CopyPixelOperation.CaptureBlt); // graphics.CopyFromScreen(captureBounds.Location, Point.Empty, captureBounds.Size, CopyPixelOperation.CaptureBlt);
// } // }
// capture.Image = capturedBitmap; // capture.Image = capturedBitmap;
// capture.Location = captureBounds.Location; // capture.Location = captureBounds.Location;

View file

@ -24,16 +24,16 @@ using System.Runtime.InteropServices;
namespace Greenshot.Base.IEInterop namespace Greenshot.Base.IEInterop
{ {
// IWebBrowser: EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B // IWebBrowser: EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B
// [ComVisible(true), ComImport(), Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E"), // [ComVisible(true), ComImport(), Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E"),
// TypeLibType(TypeLibTypeFlags.FDual), // TypeLibType(TypeLibTypeFlags.FDual),
// InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)] // InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
// public interface IWebBrowser2 { // public interface IWebBrowser2 {
// [DispId(203)] // [DispId(203)]
// object Document { // object Document {
// [return: MarshalAs(UnmanagedType.IDispatch)] // [return: MarshalAs(UnmanagedType.IDispatch)]
// get; // get;
// } // }
// } // }
[ComImport, /*SuppressUnmanagedCodeSecurity,*/ [ComImport, /*SuppressUnmanagedCodeSecurity,*/
TypeLibType(TypeLibTypeFlags.FOleAutomation | TypeLibType(TypeLibTypeFlags.FOleAutomation |
TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDual |

View file

@ -443,66 +443,66 @@ namespace Greenshot.Editor.Drawing
public void SetForegroundColor(Color color) public void SetForegroundColor(Color color)
{ {
var dcs = ToArray(); var dcs = ToArray();
var field = FieldType.LINE_COLOR; var field = FieldType.LINE_COLOR;
foreach (var dc in dcs) foreach (var dc in dcs)
{ {
if (dc is not AbstractFieldHolderWithChildren fh) continue; if (dc is not AbstractFieldHolderWithChildren fh) continue;
if (!fh.HasField(field)) continue; if (!fh.HasField(field)) continue;
fh.SetFieldValue(field, color); fh.SetFieldValue(field, color);
} }
} }
public void SetBackgroundColor(Color color) public void SetBackgroundColor(Color color)
{ {
var dcs = ToArray(); var dcs = ToArray();
var field = FieldType.FILL_COLOR; var field = FieldType.FILL_COLOR;
foreach (var dc in dcs) foreach (var dc in dcs)
{ {
if (dc is not AbstractFieldHolderWithChildren fh) continue; if (dc is not AbstractFieldHolderWithChildren fh) continue;
if (!fh.HasField(field)) continue; if (!fh.HasField(field)) continue;
fh.SetFieldValue(field, color); fh.SetFieldValue(field, color);
} }
} }
public int IncreaseLineThickness(int increaseBy) public int IncreaseLineThickness(int increaseBy)
{ {
var dcs = ToArray(); var dcs = ToArray();
var field = FieldType.LINE_THICKNESS; var field = FieldType.LINE_THICKNESS;
var lastThickness = 0; var lastThickness = 0;
foreach (var dc in dcs) foreach (var dc in dcs)
{ {
if (dc is not AbstractFieldHolderWithChildren fh) continue; if (dc is not AbstractFieldHolderWithChildren fh) continue;
if (!fh.HasField(field)) continue; if (!fh.HasField(field)) continue;
var currentThickness = (int)fh.GetFieldValue(field); var currentThickness = (int)fh.GetFieldValue(field);
var thickness = Math.Max(0, currentThickness + increaseBy); var thickness = Math.Max(0, currentThickness + increaseBy);
fh.SetFieldValue(field, thickness); fh.SetFieldValue(field, thickness);
lastThickness = thickness; lastThickness = thickness;
} }
return lastThickness; return lastThickness;
} }
public bool FlipShadow() public bool FlipShadow()
{ {
var dcs = ToArray(); var dcs = ToArray();
var field = FieldType.SHADOW; var field = FieldType.SHADOW;
var lastShadow = false; var lastShadow = false;
foreach (var dc in dcs) foreach (var dc in dcs)
{ {
if (dc is not AbstractFieldHolderWithChildren fh) continue; if (dc is not AbstractFieldHolderWithChildren fh) continue;
if (!fh.HasField(field)) continue; if (!fh.HasField(field)) continue;
var currentShadow = (bool)fh.GetFieldValue(field); var currentShadow = (bool)fh.GetFieldValue(field);
var shadow = !currentShadow; var shadow = !currentShadow;
fh.SetFieldValue(field, shadow); fh.SetFieldValue(field, shadow);
lastShadow = shadow; lastShadow = shadow;
} }
return lastShadow; return lastShadow;
} }
/// <summary> /// <summary>

View file

@ -80,9 +80,9 @@ namespace Greenshot.Editor.Drawing
} }
/** /**
* This Dispose is called from the Dispose and the Destructor. * This Dispose is called from the Dispose and the Destructor.
* When disposing==true all non-managed resources should be freed too! * When disposing==true all non-managed resources should be freed too!
*/ */
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing) if (disposing)

View file

@ -2606,31 +2606,31 @@ namespace Greenshot.Editor.Drawing
// for laptops without numPads, also allow shift modifier // for laptops without numPads, also allow shift modifier
private void SetSelectedElementColor(Color color, bool numPad, bool shift) private void SetSelectedElementColor(Color color, bool numPad, bool shift)
{ {
if (numPad || shift) if (numPad || shift)
{ {
selectedElements.SetForegroundColor(color); selectedElements.SetForegroundColor(color);
UpdateForegroundColorEvent(this, color); UpdateForegroundColorEvent(this, color);
} }
else else
{ {
selectedElements.SetBackgroundColor(color); selectedElements.SetBackgroundColor(color);
UpdateBackgroundColorEvent(this, color); UpdateBackgroundColorEvent(this, color);
} }
selectedElements.Invalidate(); selectedElements.Invalidate();
} }
private void ChangeLineThickness(int increaseBy) private void ChangeLineThickness(int increaseBy)
{ {
var newThickness = selectedElements.IncreaseLineThickness(increaseBy); var newThickness = selectedElements.IncreaseLineThickness(increaseBy);
UpdateLineThicknessEvent(this, newThickness); UpdateLineThicknessEvent(this, newThickness);
selectedElements.Invalidate(); selectedElements.Invalidate();
} }
private void FlipShadow() private void FlipShadow()
{ {
var shadow = selectedElements.FlipShadow(); var shadow = selectedElements.FlipShadow();
UpdateShadowEvent(this, shadow); UpdateShadowEvent(this, shadow);
selectedElements.Invalidate(); selectedElements.Invalidate();
} }
/// <summary> /// <summary>

View file

@ -635,8 +635,8 @@ namespace Greenshot.Editor.Forms
} }
/** /**
* Interfaces for plugins, see GreenshotInterface for more details! * Interfaces for plugins, see GreenshotInterface for more details!
*/ */
public Image GetImageForExport() public Image GetImageForExport()
{ {
return _surface.GetImageForExport(); return _surface.GetImageForExport();

View file

@ -282,8 +282,8 @@ namespace Greenshot.Plugin.Office.OfficeExport
// Use this to change the format, it will probably lose the current selection. // Use this to change the format, it will probably lose the current selection.
//if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) { //if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) {
// Log.Info().WriteLine("Changing format to HTML."); // Log.Info().WriteLine("Changing format to HTML.");
// currentMail.BodyFormat = OlBodyFormat.olFormatHTML; // currentMail.BodyFormat = OlBodyFormat.olFormatHTML;
//} //}
bool inlinePossible = false; bool inlinePossible = false;

View file

@ -1019,7 +1019,7 @@ namespace Greenshot.Forms
// TODO: enable when the screen capture code works reliable // TODO: enable when the screen capture code works reliable
//if (capture.CaptureDetails.CaptureMode == CaptureMode.Video) { //if (capture.CaptureDetails.CaptureMode == CaptureMode.Video) {
// graphics.FillRectangle(RedOverlayBrush, fixedRect); // graphics.FillRectangle(RedOverlayBrush, fixedRect);
//} else { //} else {
graphics.FillRectangle(GreenOverlayBrush, fixedRect); graphics.FillRectangle(GreenOverlayBrush, fixedRect);
//} //}

View file

@ -501,7 +501,7 @@ namespace Greenshot.Helpers
_capture = WindowCapture.CaptureRectangle(_capture, CoreConfig.LastCapturedRegion); _capture = WindowCapture.CaptureRectangle(_capture, CoreConfig.LastCapturedRegion);
// TODO: Reactive / check if the elements code is activated // TODO: Reactive / check if the elements code is activated
//if (windowDetailsThread != null) { //if (windowDetailsThread != null) {
// windowDetailsThread.Join(); // windowDetailsThread.Join();
//} //}
// Set capture title, fixing bug #3569703 // Set capture title, fixing bug #3569703

View file

@ -60,17 +60,17 @@ namespace Greenshot.Helpers
} }
/** /**
* Destructor * Destructor
*/ */
~PrintHelper() ~PrintHelper()
{ {
Dispose(false); Dispose(false);
} }
/** /**
* The public accessible Dispose * The public accessible Dispose
* Will call the GarbageCollector to SuppressFinalize, preventing being cleaned twice * Will call the GarbageCollector to SuppressFinalize, preventing being cleaned twice
*/ */
public void Dispose() public void Dispose()
{ {
Dispose(true); Dispose(true);
@ -78,9 +78,9 @@ namespace Greenshot.Helpers
} }
/** /**
* This Dispose is called from the Dispose and the Destructor. * This Dispose is called from the Dispose and the Destructor.
* When disposing==true all non-managed resources should be freed too! * When disposing==true all non-managed resources should be freed too!
*/ */
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
if (disposing) if (disposing)