BUG-1908: Made Greenshot recheck & add the external commands like Ms-Paint and Paint.NET if they are not deleted manually and not yet available. Also cleaned up some code.

This commit is contained in:
Robin 2016-09-16 21:48:57 +02:00
parent 35ed3b8d60
commit 6efc7796b8
49 changed files with 322 additions and 294 deletions

View file

@ -41,7 +41,7 @@ namespace Greenshot.Controls {
CheckedChanged += BindableToolStripButton_CheckedChanged;
}
void BindableToolStripButton_CheckedChanged(object sender, EventArgs e) {
private void BindableToolStripButton_CheckedChanged(object sender, EventArgs e) {
if(PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Checked"));
}
}

View file

@ -41,7 +41,7 @@ namespace Greenshot.Controls {
SelectedIndexChanged += BindableToolStripComboBox_SelectedIndexChanged;
}
void BindableToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) {
private void BindableToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) {
if(PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs("SelectedItem"));

View file

@ -67,7 +67,7 @@ namespace Greenshot.Controls {
}
}
void ColorButtonClick(object sender, EventArgs e) {
private void ColorButtonClick(object sender, EventArgs e) {
ColorDialog colorDialog = ColorDialog.GetInstance();
colorDialog.Color = SelectedColor;
// Using the parent to make sure the dialog doesn't show on another window

View file

@ -53,7 +53,7 @@ namespace Greenshot.Controls {
}
}
void ComboBox_DrawItem(object sender, DrawItemEventArgs e) {
private void ComboBox_DrawItem(object sender, DrawItemEventArgs e) {
// DrawBackground handles drawing the background (i.e,. hot-tracked v. not)
// It uses the system colors (Bluish, and and white, by default)
// same as calling e.Graphics.FillRectangle ( SystemBrushes.Highlight, e.Bounds );
@ -108,7 +108,7 @@ namespace Greenshot.Controls {
}
}
void BindableToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) {
private void BindableToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs("Text"));
PropertyChanged(this, new PropertyChangedEventArgs("FontFamily"));

View file

@ -29,7 +29,7 @@ namespace Greenshot.Controls {
public class MenuStripEx : MenuStrip {
private const int WM_MOUSEACTIVATE = 0x21;
enum NativeConstants : uint {
private enum NativeConstants : uint {
MA_ACTIVATE = 1,
MA_ACTIVATEANDEAT = 2,
}

View file

@ -65,7 +65,7 @@ namespace Greenshot.Controls {
}
}
void ColorButtonClick(object sender, EventArgs e) {
private void ColorButtonClick(object sender, EventArgs e) {
ColorDialog colorDialog = ColorDialog.GetInstance();
colorDialog.Color = SelectedColor;
// Using the parent to make sure the dialog doesn't show on another window

View file

@ -26,10 +26,10 @@ namespace Greenshot.Controls {
/// This is an extension of the default ToolStrip and allows us to click it even when the form doesn't have focus.
/// See: http://blogs.msdn.com/b/rickbrew/archive/2006/01/09/511003.aspx
/// </summary>
class ToolStripEx : ToolStrip {
internal class ToolStripEx : ToolStrip {
private const int WM_MOUSEACTIVATE = 0x21;
enum NativeConstants : uint {
private enum NativeConstants : uint {
MA_ACTIVATE = 1,
MA_ACTIVATEANDEAT = 2,
}

View file

@ -34,8 +34,7 @@ namespace Greenshot.Drawing.Fields
[Serializable()]
public abstract class AbstractFieldHolderWithChildren : AbstractFieldHolder
{
FieldChangedEventHandler fieldChangedEventHandler;
private FieldChangedEventHandler fieldChangedEventHandler;
[NonSerialized]
private EventHandler childrenChanged;

View file

@ -47,7 +47,7 @@ namespace Greenshot.Drawing.Fields
private IDrawableContainerList boundContainers;
private bool internalUpdateRunning = false;
enum Status { IDLE, BINDING, UPDATING };
private enum Status { IDLE, BINDING, UPDATING };
private static readonly ILog LOG = LogManager.GetLogger(typeof(FieldAggregator));
private static EditorConfiguration editorConfiguration = IniConfig.GetIniSection<EditorConfiguration>();

View file

@ -1169,7 +1169,7 @@ namespace Greenshot.Drawing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SurfaceMouseDown(object sender, MouseEventArgs e)
private void SurfaceMouseDown(object sender, MouseEventArgs e)
{
// Handle Adorners
@ -1261,7 +1261,7 @@ namespace Greenshot.Drawing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SurfaceMouseUp(object sender, MouseEventArgs e)
private void SurfaceMouseUp(object sender, MouseEventArgs e)
{
// Handle Adorners
@ -1350,7 +1350,7 @@ namespace Greenshot.Drawing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SurfaceMouseMove(object sender, MouseEventArgs e)
private void SurfaceMouseMove(object sender, MouseEventArgs e)
{
// Handle Adorners
var adorner = FindActiveAdorner(e);
@ -1417,7 +1417,7 @@ namespace Greenshot.Drawing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SurfaceDoubleClick(object sender, MouseEventArgs e)
private void SurfaceDoubleClick(object sender, MouseEventArgs e)
{
selectedElements.OnDoubleClick();
selectedElements.Invalidate();
@ -1459,7 +1459,7 @@ namespace Greenshot.Drawing
/// </summary>
/// <param name="sender"></param>
/// <param name="paintEventArgs">PaintEventArgs</param>
void SurfacePaint(object sender, PaintEventArgs paintEventArgs)
private void SurfacePaint(object sender, PaintEventArgs paintEventArgs)
{
Graphics targetGraphics = paintEventArgs.Graphics;
Rectangle clipRectangle = paintEventArgs.ClipRectangle;

View file

@ -116,7 +116,7 @@ namespace Greenshot {
// 18 19 20 21 22 23
// The order in which we draw the dots & flow the collors.
readonly List<int> flowOrder = new List<int>() { 4, 3, 2, 1, 0, 5, 6, 7, 8, 9, 10, 14, 15, 18, 19, 20, 21, 22, 23, 16, 17, 13, 12, 11 };
private readonly List<int> flowOrder = new List<int>() { 4, 3, 2, 1, 0, 5, 6, 7, 8, 9, 10, 14, 15, 18, 19, 20, 21, 22, 23, 16, 17, 13, 12, 11 };
/// <summary>
/// Cleanup all the allocated resources
@ -211,7 +211,7 @@ namespace Greenshot {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void LinkLabelClicked(object sender, LinkLabelLinkClickedEventArgs e) {
private void LinkLabelClicked(object sender, LinkLabelLinkClickedEventArgs e) {
LinkLabel linkLabel = sender as LinkLabel;
if (linkLabel != null) {
try {

View file

@ -38,7 +38,7 @@ namespace Greenshot.Forms {
textBoxDescription.Text = bugText;
}
void LinkLblBugsLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
private void LinkLblBugsLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
openLink((LinkLabel)sender);
}

View file

@ -185,7 +185,7 @@ namespace Greenshot.Forms {
/// <summary>
/// Create an animation for the zoomer, depending on if it's active or not.
/// </summary>
void InitializeZoomer(bool isOn) {
private void InitializeZoomer(bool isOn) {
if (isOn) {
// Initialize the zoom with a invalid position
_zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(int.MaxValue, int.MaxValue, 0, 0), FramesForMillis(1000), EasingType.Quintic, EasingMode.EaseOut);
@ -196,7 +196,8 @@ namespace Greenshot.Forms {
}
#region key handling
void CaptureFormKeyUp(object sender, KeyEventArgs e) {
private void CaptureFormKeyUp(object sender, KeyEventArgs e) {
switch(e.KeyCode) {
case Keys.ShiftKey:
_fixMode = FixMode.None;
@ -212,7 +213,7 @@ namespace Greenshot.Forms {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void CaptureFormKeyDown(object sender, KeyEventArgs e) {
private void CaptureFormKeyDown(object sender, KeyEventArgs e) {
int step = _isCtrlPressed ? 10 : 1;
switch (e.KeyCode) {
@ -319,7 +320,7 @@ namespace Greenshot.Forms {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void OnMouseDown(object sender, MouseEventArgs e) {
private void OnMouseDown(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
HandleMouseDown();
}
@ -360,7 +361,7 @@ namespace Greenshot.Forms {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void OnMouseUp(object sender, MouseEventArgs e) {
private void OnMouseUp(object sender, MouseEventArgs e) {
if (_mouseDown) {
HandleMouseUp();
}
@ -392,7 +393,7 @@ namespace Greenshot.Forms {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void OnMouseMove(object sender, MouseEventArgs e) {
private void OnMouseMove(object sender, MouseEventArgs e) {
// Make sure the mouse coordinates are fixed, when pressing shift
_mouseMovePos = FixMouseCoordinates(User32.GetCursorLocation());
_mouseMovePos = WindowCapture.GetLocationRelativeToScreenBounds(_mouseMovePos);
@ -704,7 +705,7 @@ namespace Greenshot.Forms {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void OnPaint(object sender, PaintEventArgs e) {
private void OnPaint(object sender, PaintEventArgs e) {
Graphics graphics = e.Graphics;
Rectangle clipRectangle = e.ClipRectangle;
//graphics.BitBlt((Bitmap)buffer, Point.Empty);

View file

@ -165,7 +165,8 @@ namespace Greenshot {
#endregion
#region textbox event handlers
void TextBoxHexadecimalTextChanged(object sender, EventArgs e) {
private void TextBoxHexadecimalTextChanged(object sender, EventArgs e) {
if (_updateInProgress) {
return;
}
@ -188,7 +189,7 @@ namespace Greenshot {
PreviewColor(opaqueColor, textBox);
}
void TextBoxRGBTextChanged(object sender, EventArgs e) {
private void TextBoxRGBTextChanged(object sender, EventArgs e) {
if (_updateInProgress) {
return;
}
@ -196,11 +197,11 @@ namespace Greenshot {
PreviewColor(Color.FromArgb(GetColorPartIntFromString(textBoxAlpha.Text), GetColorPartIntFromString(textBoxRed.Text), GetColorPartIntFromString(textBoxGreen.Text), GetColorPartIntFromString(textBoxBlue.Text)), textBox);
}
void TextBoxGotFocus(object sender, EventArgs e) {
private void TextBoxGotFocus(object sender, EventArgs e) {
textBoxHtmlColor.SelectAll();
}
void TextBoxKeyDown(object sender, KeyEventArgs e) {
private void TextBoxKeyDown(object sender, KeyEventArgs e) {
if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter) {
AddToRecentColors(colorPanel.BackColor);
}
@ -208,15 +209,17 @@ namespace Greenshot {
#endregion
#region button event handlers
void ColorButtonClick(object sender, EventArgs e) {
private void ColorButtonClick(object sender, EventArgs e) {
Button b = (Button)sender;
PreviewColor(b.BackColor, b);
}
void BtnTransparentClick(object sender, EventArgs e) {
private void BtnTransparentClick(object sender, EventArgs e) {
ColorButtonClick(sender, e);
}
void BtnApplyClick(object sender, EventArgs e) {
private void BtnApplyClick(object sender, EventArgs e) {
DialogResult = DialogResult.OK;
Hide();
AddToRecentColors(colorPanel.BackColor);

View file

@ -79,7 +79,7 @@ namespace Greenshot.Forms {
}
}
void BtnOKClick(object sender, EventArgs e) {
private void BtnOKClick(object sender, EventArgs e) {
properOkPressed = true;
// Fix for Bug #3431100
Language.CurrentLanguage = SelectedLanguage;

View file

@ -648,24 +648,26 @@ namespace Greenshot {
#region mainform events
void MainFormFormClosing(object sender, FormClosingEventArgs e) {
private void MainFormFormClosing(object sender, FormClosingEventArgs e) {
LOG.DebugFormat("Mainform closing, reason: {0}", e.CloseReason);
_instance = null;
Exit();
}
void MainFormActivated(object sender, EventArgs e) {
private void MainFormActivated(object sender, EventArgs e) {
Hide();
ShowInTaskbar = false;
}
#endregion
#region key handlers
void CaptureRegion() {
private void CaptureRegion() {
CaptureHelper.CaptureRegion(true);
}
void CaptureFile() {
private void CaptureFile() {
var openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Image files (*.greenshot, *.png, *.jpg, *.gif, *.bmp, *.ico, *.tiff, *.wmf)|*.greenshot; *.png; *.jpg; *.jpeg; *.gif; *.bmp; *.ico; *.tiff; *.tif; *.wmf";
if (openFileDialog.ShowDialog() == DialogResult.OK) {
@ -675,21 +677,21 @@ namespace Greenshot {
}
}
void CaptureFullScreen() {
private void CaptureFullScreen() {
CaptureHelper.CaptureFullscreen(true, _conf.ScreenCaptureMode);
}
void CaptureLastRegion() {
private void CaptureLastRegion() {
CaptureHelper.CaptureLastRegion(true);
}
void CaptureIE() {
private void CaptureIE() {
if (_conf.IECapture) {
CaptureHelper.CaptureIE(true, null);
}
}
void CaptureWindow() {
private void CaptureWindow() {
if (_conf.CaptureWindowsInteractive) {
CaptureHelper.CaptureWindowInteractive(true);
} else {
@ -700,7 +702,8 @@ namespace Greenshot {
#region contextmenu
void ContextMenuOpening(object sender, CancelEventArgs e) {
private void ContextMenuOpening(object sender, CancelEventArgs e) {
contextmenu_captureclipboard.Enabled = ClipboardHelper.ContainsImage();
contextmenu_capturelastregion.Enabled = coreConfiguration.LastCapturedRegion != Rectangle.Empty;
@ -736,7 +739,7 @@ namespace Greenshot {
}
}
void ContextMenuClosing(object sender, EventArgs e) {
private void ContextMenuClosing(object sender, EventArgs e) {
contextmenu_captureiefromlist.DropDownItems.Clear();
contextmenu_capturewindowfromlist.DropDownItems.Clear();
CleanupThumbnail();
@ -745,7 +748,7 @@ namespace Greenshot {
/// <summary>
/// Build a selectable list of IE tabs when we enter the menu item
/// </summary>
void CaptureIEMenuDropDownOpening(object sender, EventArgs e) {
private void CaptureIEMenuDropDownOpening(object sender, EventArgs e) {
if (!_conf.IECapture) {
return;
}
@ -903,43 +906,43 @@ namespace Greenshot {
}
}
void CaptureAreaToolStripMenuItemClick(object sender, EventArgs e) {
private void CaptureAreaToolStripMenuItemClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
CaptureHelper.CaptureRegion(false);
});
}
void CaptureClipboardToolStripMenuItemClick(object sender, EventArgs e) {
private void CaptureClipboardToolStripMenuItemClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
CaptureHelper.CaptureClipboard();
});
}
void OpenFileToolStripMenuItemClick(object sender, EventArgs e) {
private void OpenFileToolStripMenuItemClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
CaptureFile();
});
}
void CaptureFullScreenToolStripMenuItemClick(object sender, EventArgs e) {
private void CaptureFullScreenToolStripMenuItemClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
CaptureHelper.CaptureFullscreen(false, _conf.ScreenCaptureMode);
});
}
void Contextmenu_capturelastregionClick(object sender, EventArgs e) {
private void Contextmenu_capturelastregionClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
CaptureHelper.CaptureLastRegion(false);
});
}
void Contextmenu_capturewindow_Click(object sender,EventArgs e) {
private void Contextmenu_capturewindow_Click(object sender,EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
CaptureHelper.CaptureWindowInteractive(false);
});
}
void Contextmenu_capturewindowfromlist_Click(object sender,EventArgs e) {
private void Contextmenu_capturewindowfromlist_Click(object sender,EventArgs e) {
ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;
BeginInvoke((MethodInvoker)delegate {
try {
@ -951,11 +954,11 @@ namespace Greenshot {
});
}
void Contextmenu_captureie_Click(object sender, EventArgs e) {
private void Contextmenu_captureie_Click(object sender, EventArgs e) {
CaptureIE();
}
void Contextmenu_captureiefromlist_Click(object sender, EventArgs e) {
private void Contextmenu_captureiefromlist_Click(object sender, EventArgs e) {
if (!_conf.IECapture) {
LOG.InfoFormat("IE Capture is disabled.");
return;
@ -985,7 +988,7 @@ namespace Greenshot {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Contextmenu_donateClick(object sender, EventArgs e) {
private void Contextmenu_donateClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
Process.Start("http://getgreenshot.org/support/");
});
@ -996,7 +999,7 @@ namespace Greenshot {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Contextmenu_settingsClick(object sender, EventArgs e) {
private void Contextmenu_settingsClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
ShowSetting();
});
@ -1026,7 +1029,7 @@ namespace Greenshot {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Contextmenu_aboutClick(object sender, EventArgs e) {
private void Contextmenu_aboutClick(object sender, EventArgs e) {
ShowAbout();
}
@ -1049,7 +1052,7 @@ namespace Greenshot {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Contextmenu_helpClick(object sender, EventArgs e) {
private void Contextmenu_helpClick(object sender, EventArgs e) {
HelpFileLoader.LoadHelp();
}
@ -1058,7 +1061,7 @@ namespace Greenshot {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Contextmenu_exitClick(object sender, EventArgs e) {
private void Contextmenu_exitClick(object sender, EventArgs e) {
Exit();
}
@ -1151,7 +1154,7 @@ namespace Greenshot {
}
}
void QuickSettingCaptureModeChanged(object sender, EventArgs e) {
private void QuickSettingCaptureModeChanged(object sender, EventArgs e) {
ToolStripMenuSelectListItem item = ((ItemCheckedChangedEventArgs)e).Item;
WindowCaptureMode windowsCaptureMode = (WindowCaptureMode)item.Data;
if (item.Checked) {
@ -1159,7 +1162,7 @@ namespace Greenshot {
}
}
void QuickSettingBoolItemChanged(object sender, EventArgs e) {
private void QuickSettingBoolItemChanged(object sender, EventArgs e) {
ToolStripMenuSelectListItem item = ((ItemCheckedChangedEventArgs)e).Item;
IniValue iniValue = item.Data as IniValue;
if (iniValue != null) {
@ -1168,7 +1171,7 @@ namespace Greenshot {
}
}
void QuickSettingDestinationChanged(object sender, EventArgs e) {
private void QuickSettingDestinationChanged(object sender, EventArgs e) {
ToolStripMenuSelectListItem item = ((ItemCheckedChangedEventArgs)e).Item;
IDestination selectedDestination = (IDestination)item.Data;
if (item.Checked) {

View file

@ -36,7 +36,7 @@ namespace Greenshot.Forms {
}
void Button_okClick(object sender, EventArgs e) {
private void Button_okClick(object sender, EventArgs e) {
// update config
coreConfiguration.OutputPrintPromptOptions = !checkbox_dontaskagain.Checked;
IniConfig.Save();

View file

@ -468,11 +468,11 @@ namespace Greenshot {
}
}
void Settings_cancelClick(object sender, EventArgs e) {
private void Settings_cancelClick(object sender, EventArgs e) {
DialogResult = DialogResult.Cancel;
}
void Settings_okayClick(object sender, EventArgs e) {
private void Settings_okayClick(object sender, EventArgs e) {
if (CheckSettings()) {
HotkeyControl.UnregisterHotkeys();
SaveSettings();
@ -487,7 +487,7 @@ namespace Greenshot {
}
}
void BrowseClick(object sender, EventArgs e) {
private void BrowseClick(object sender, EventArgs e) {
// Get the storage location and replace the environment variables
folderBrowserDialog1.SelectedPath = FilenameHelper.FillVariables(textbox_storagelocation.Text, false);
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) {
@ -498,27 +498,27 @@ namespace Greenshot {
}
}
void TrackBarJpegQualityScroll(object sender, EventArgs e) {
private void TrackBarJpegQualityScroll(object sender, EventArgs e) {
textBoxJpegQuality.Text = trackBarJpegQuality.Value.ToString(CultureInfo.InvariantCulture);
}
void BtnPatternHelpClick(object sender, EventArgs e) {
private void BtnPatternHelpClick(object sender, EventArgs e) {
string filenamepatternText = Language.GetString(LangKey.settings_message_filenamepattern);
// Convert %NUM% to ${NUM} for old language files!
filenamepatternText = Regex.Replace(filenamepatternText, "%([a-zA-Z_0-9]+)%", @"${$1}");
MessageBox.Show(filenamepatternText, Language.GetString(LangKey.settings_filenamepattern));
}
void Listview_pluginsSelectedIndexChanged(object sender, EventArgs e) {
private void Listview_pluginsSelectedIndexChanged(object sender, EventArgs e) {
button_pluginconfigure.Enabled = PluginHelper.Instance.isSelectedItemConfigurable(listview_plugins);
}
void Button_pluginconfigureClick(object sender, EventArgs e) {
private void Button_pluginconfigureClick(object sender, EventArgs e) {
PluginHelper.Instance.ConfigureSelectedItem(listview_plugins);
}
void Combobox_languageSelectedIndexChanged(object sender, EventArgs e) {
private void Combobox_languageSelectedIndexChanged(object sender, EventArgs e) {
// Get the combobox values BEFORE changing the language
//EmailFormat selectedEmailFormat = GetSelected<EmailFormat>(combobox_emailformat);
WindowCaptureMode selectedWindowCaptureMode = GetSelected<WindowCaptureMode>(combobox_window_capture_mode);
@ -537,7 +537,7 @@ namespace Greenshot {
SetWindowCaptureMode(selectedWindowCaptureMode);
}
void Combobox_window_capture_modeSelectedIndexChanged(object sender, EventArgs e) {
private void Combobox_window_capture_modeSelectedIndexChanged(object sender, EventArgs e) {
int windowsVersion = Environment.OSVersion.Version.Major;
WindowCaptureMode mode = GetSelected<WindowCaptureMode>(combobox_window_capture_mode);
if (windowsVersion >= 6) {
@ -553,7 +553,7 @@ namespace Greenshot {
/// <summary>
/// Check the destination settings
/// </summary>
void CheckDestinationSettings() {
private void CheckDestinationSettings() {
bool clipboardDestinationChecked = false;
bool pickerSelected = checkbox_picker.Checked;
bool destinationsEnabled = true;
@ -588,7 +588,7 @@ namespace Greenshot {
}
}
void DestinationsCheckStateChanged(object sender, EventArgs e) {
private void DestinationsCheckStateChanged(object sender, EventArgs e) {
CheckDestinationSettings();
}

View file

@ -32,7 +32,7 @@ namespace Greenshot {
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) {
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) {
Assembly ayResult = null;
string sShortAssemblyName = args.Name.Split(',')[0];
Assembly[] ayAssemblies = AppDomain.CurrentDomain.GetAssemblies();

View file

@ -155,7 +155,7 @@ namespace Greenshot.Helpers {
return ret;
}
void DrawImageForPrint(object sender, PrintPageEventArgs e) {
private void DrawImageForPrint(object sender, PrintPageEventArgs e) {
// Create the output settins

View file

@ -29,7 +29,7 @@ namespace Greenshot.Helpers {
/// </summary>
public static class ToolStripItemEndisabler {
[Flags]
enum PropagationMode {NONE=0, CHILDREN=1, ANCESTORS=2};
private enum PropagationMode {NONE=0, CHILDREN=1, ANCESTORS=2};
/// <summary>
/// Enables all of a ToolStrip's children (recursively),

View file

@ -31,9 +31,9 @@ namespace Greenshot.Memento
/// </summary>
public class DrawableContainerBoundsChangeMemento : IMemento
{
List<Point> points = new List<Point>();
List<Size> sizes = new List<Size>();
IDrawableContainerList listOfdrawableContainer;
private List<Point> points = new List<Point>();
private List<Size> sizes = new List<Size>();
private IDrawableContainerList listOfdrawableContainer;
private void StoreBounds()
{

View file

@ -39,7 +39,7 @@ namespace GreenshotConfluencePlugin {
InitializeComponent();
}
void Button_OK_Click(object sender, RoutedEventArgs e) {
private void Button_OK_Click(object sender, RoutedEventArgs e) {
DialogResult = true;
}
}

View file

@ -36,11 +36,11 @@ namespace GreenshotConfluencePlugin {
InitializeComponent();
}
void PageListView_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) {
private void PageListView_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) {
SelectionChanged();
}
void SelectionChanged() {
private void SelectionChanged() {
if (PageListView.HasItems && PageListView.SelectedItems.Count > 0) {
confluenceUpload.SelectedPage = (Page)PageListView.SelectedItem;
// Make sure the uploader knows we selected an already opened page
@ -50,7 +50,7 @@ namespace GreenshotConfluencePlugin {
}
}
void Page_Loaded(object sender, System.Windows.RoutedEventArgs e) {
private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e) {
SelectionChanged();
}
}

View file

@ -111,7 +111,7 @@ namespace GreenshotConfluencePlugin {
}
}
void UpdateSpaces() {
private void UpdateSpaces() {
if (_spaces != null && DateTime.Now.AddMinutes(-60).CompareTo(_lastLoad) > 0) {
// Reset
_spaces = null;
@ -125,7 +125,7 @@ namespace GreenshotConfluencePlugin {
}
}
void Upload_Click(object sender, RoutedEventArgs e) {
private void Upload_Click(object sender, RoutedEventArgs e) {
DialogResult = true;
}
}

View file

@ -24,7 +24,7 @@ using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
namespace GreenshotDropboxPlugin {
class DropboxDestination : AbstractDestination {
internal class DropboxDestination : AbstractDestination {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(DropboxDestination));
private static readonly DropboxPluginConfiguration config = IniConfig.GetIniSection<DropboxPluginConfiguration>();

View file

@ -52,28 +52,85 @@ namespace ExternalCommand {
public bool UriToClipboard { get; set; }
[IniProperty("Commandline", Description="The commandline for the output command.")]
public Dictionary<string, string> commandlines { get; set; }
public Dictionary<string, string> Commandline { get; set; }
[IniProperty("Argument", Description="The arguments for the output command.")]
public Dictionary<string, string> arguments { get; set; }
public Dictionary<string, string> Argument { get; set; }
[IniProperty("RunInbackground", Description = "Should the command be started in the background.")]
public Dictionary<string, bool> runInbackground { get; set; }
public Dictionary<string, bool> RunInbackground { get; set; }
private const string MSPAINT = "MS Paint";
private static readonly string paintPath;
private static readonly bool hasPaint = false;
[IniProperty("DeletedBuildInCommands", Description = "If a build in command was deleted manually, it should not be recreated.")]
public List<string> DeletedBuildInCommands { get; set; }
private const string PAINTDOTNET = "Paint.NET";
private static readonly string paintDotNetPath;
private static readonly bool hasPaintDotNet = false;
private const string MsPaint = "MS Paint";
private static readonly string PaintPath;
private static readonly bool HasPaint;
private const string PaintDotNet = "Paint.NET";
private static readonly string PaintDotNetPath;
private static readonly bool HasPaintDotNet;
static ExternalCommandConfiguration() {
try {
paintPath = PluginUtils.GetExePath("pbrush.exe");
hasPaint = !string.IsNullOrEmpty(paintPath) && File.Exists(paintPath);
paintDotNetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Paint.NET\PaintDotNet.exe");
hasPaintDotNet = !string.IsNullOrEmpty(paintDotNetPath) && File.Exists(paintDotNetPath);
PaintPath = PluginUtils.GetExePath("pbrush.exe");
HasPaint = !string.IsNullOrEmpty(PaintPath) && File.Exists(PaintPath);
} catch {
// Ignore
}
try
{
PaintDotNetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Paint.NET\PaintDotNet.exe");
HasPaintDotNet = !string.IsNullOrEmpty(PaintDotNetPath) && File.Exists(PaintDotNetPath);
}
catch
{
// Ignore
}
}
/// <summary>
/// Delete the configuration for the specified command
/// </summary>
/// <param name="command">string with command</param>
public void Delete(string command)
{
if (string.IsNullOrEmpty(command))
{
return;
}
Commands.Remove(command);
Commandline.Remove(command);
Argument.Remove(command);
RunInbackground.Remove(command);
if (MsPaint.Equals(command) || PaintDotNet.Equals(command))
{
if (!DeletedBuildInCommands.Contains(command))
{
DeletedBuildInCommands.Add(command);
}
}
}
public override void AfterLoad()
{
base.AfterLoad();
// Check if we need to add MsPaint
if (HasPaint && !Commands.Contains(MsPaint) && !DeletedBuildInCommands.Contains(MsPaint))
{
Commands.Add(MsPaint);
Commandline.Add(MsPaint, PaintPath);
Argument.Add(MsPaint, "\"{0}\"");
RunInbackground.Add(MsPaint, true);
}
// Check if we need to add Paint.NET
if (HasPaintDotNet && !Commands.Contains(PaintDotNet) && !DeletedBuildInCommands.Contains(PaintDotNet))
{
Commands.Add(PaintDotNet);
Commandline.Add(PaintDotNet, PaintDotNetPath);
Argument.Add(PaintDotNet, "\"{0}\"");
RunInbackground.Add(PaintDotNet, true);
}
}
@ -84,42 +141,16 @@ namespace ExternalCommand {
/// <returns>object with the default value for the supplied property</returns>
public override object GetDefault(string property) {
switch(property) {
case "Commands":
List<string> commandDefaults = new List<string>();
if (hasPaintDotNet) {
commandDefaults.Add(PAINTDOTNET);
}
if (hasPaint) {
commandDefaults.Add(MSPAINT);
}
return commandDefaults;
case "Commandline":
Dictionary<string, string> commandlineDefaults = new Dictionary<string, string>();
if (hasPaintDotNet) {
commandlineDefaults.Add(PAINTDOTNET, paintDotNetPath);
}
if (hasPaint) {
commandlineDefaults.Add(MSPAINT, paintPath);
}
return commandlineDefaults;
case "Argument":
Dictionary<string, string> argumentDefaults = new Dictionary<string, string>();
if (hasPaintDotNet) {
argumentDefaults.Add(PAINTDOTNET, "\"{0}\"");
}
if (hasPaint) {
argumentDefaults.Add(MSPAINT, "\"{0}\"");
}
return argumentDefaults;
case "RunInbackground":
Dictionary<string, bool> runInBackground = new Dictionary<string, bool>();
if (hasPaintDotNet) {
runInBackground.Add(PAINTDOTNET, true);
}
if (hasPaint) {
runInBackground.Add(MSPAINT, true);
}
return runInBackground;
case nameof(DeletedBuildInCommands):
return new List<string>();
case nameof(Commands):
return new List<string>();
case nameof(Commandline):
return new Dictionary<string, string>();
case nameof(Argument):
return new Dictionary<string, string>();
case nameof(RunInbackground):
return new Dictionary<string, bool>();
}
return null;
}

View file

@ -71,10 +71,10 @@ namespace ExternalCommand {
if (_presetCommand != null) {
if (!config.runInbackground.ContainsKey(_presetCommand)) {
config.runInbackground.Add(_presetCommand, true);
if (!config.RunInbackground.ContainsKey(_presetCommand)) {
config.RunInbackground.Add(_presetCommand, true);
}
bool runInBackground = config.runInbackground[_presetCommand];
bool runInBackground = config.RunInbackground[_presetCommand];
string fullPath = captureDetails.Filename;
if (fullPath == null) {
fullPath = ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings);
@ -158,13 +158,13 @@ namespace ExternalCommand {
try {
return CallExternalCommand(commando, fullPath, "runas", out output, out error);
} catch {
w32ex.Data.Add("commandline", config.commandlines[_presetCommand]);
w32ex.Data.Add("arguments", config.arguments[_presetCommand]);
w32ex.Data.Add("commandline", config.Commandline[_presetCommand]);
w32ex.Data.Add("arguments", config.Argument[_presetCommand]);
throw;
}
} catch (Exception ex) {
ex.Data.Add("commandline", config.commandlines[_presetCommand]);
ex.Data.Add("arguments", config.arguments[_presetCommand]);
ex.Data.Add("commandline", config.Commandline[_presetCommand]);
ex.Data.Add("arguments", config.Argument[_presetCommand]);
throw;
}
}
@ -179,8 +179,8 @@ namespace ExternalCommand {
/// <param name="error"></param>
/// <returns></returns>
private int CallExternalCommand(string commando, string fullPath, string verb, out string output, out string error) {
string commandline = config.commandlines[commando];
string arguments = config.arguments[commando];
string commandline = config.Commandline[commando];
string arguments = config.Argument[commando];
output = null;
error = null;
if (!string.IsNullOrEmpty(commandline)) {

View file

@ -33,9 +33,9 @@ namespace ExternalCommand {
/// An Plugin to run commands after an image was written
/// </summary>
public class ExternalCommandPlugin : IGreenshotPlugin {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ExternalCommandPlugin));
private static readonly CoreConfiguration coreConfig = IniConfig.GetIniSection<CoreConfiguration>();
private static readonly ExternalCommandConfiguration config = IniConfig.GetIniSection<ExternalCommandConfiguration>();
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(ExternalCommandPlugin));
private static readonly CoreConfiguration CoreConfig = IniConfig.GetIniSection<CoreConfiguration>();
private static readonly ExternalCommandConfiguration ExternalCommandConfig = IniConfig.GetIniSection<ExternalCommandConfiguration>();
private IGreenshotHost _host;
private PluginAttribute _myAttributes;
private ToolStripMenuItem _itemPlugInRoot;
@ -55,7 +55,7 @@ namespace ExternalCommand {
}
public IEnumerable<IDestination> Destinations() {
foreach(string command in config.Commands) {
foreach(string command in ExternalCommandConfig.Commands) {
yield return new ExternalCommandDestination(command);
}
}
@ -69,26 +69,26 @@ namespace ExternalCommand {
/// </summary>
/// <param name="command"></param>
/// <returns>false if the command is not correctly configured</returns>
private bool isCommandValid(string command) {
if (!config.runInbackground.ContainsKey(command)) {
LOG.WarnFormat("Found missing runInbackground for {0}", command);
private bool IsCommandValid(string command) {
if (!ExternalCommandConfig.RunInbackground.ContainsKey(command)) {
Log.WarnFormat("Found missing runInbackground for {0}", command);
// Fix it
config.runInbackground.Add(command, true);
ExternalCommandConfig.RunInbackground.Add(command, true);
}
if (!config.arguments.ContainsKey(command)) {
LOG.WarnFormat("Found missing argument for {0}", command);
if (!ExternalCommandConfig.Argument.ContainsKey(command)) {
Log.WarnFormat("Found missing argument for {0}", command);
// Fix it
config.arguments.Add(command, "{0}");
ExternalCommandConfig.Argument.Add(command, "{0}");
}
if (!config.commandlines.ContainsKey(command)) {
LOG.WarnFormat("Found missing commandline for {0}", command);
if (!ExternalCommandConfig.Commandline.ContainsKey(command)) {
Log.WarnFormat("Found missing commandline for {0}", command);
return false;
}
string commandline = FilenameHelper.FillVariables(config.commandlines[command], true);
string commandline = FilenameHelper.FillVariables(ExternalCommandConfig.Commandline[command], true);
commandline = FilenameHelper.FillCmdVariables(commandline, true);
if (!File.Exists(commandline)) {
LOG.WarnFormat("Found 'invalid' commandline {0} for command {1}", config.commandlines[command], command);
Log.WarnFormat("Found 'invalid' commandline {0} for command {1}", ExternalCommandConfig.Commandline[command], command);
return false;
}
return true;
@ -99,22 +99,19 @@ namespace ExternalCommand {
/// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
/// <param name="myAttributes">My own attributes</param>
public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
LOG.DebugFormat("Initialize called of {0}", myAttributes.Name);
Log.DebugFormat("Initialize called of {0}", myAttributes.Name);
List<string> commandsToDelete = new List<string>();
// Check configuration
foreach(string command in config.Commands) {
if (!isCommandValid(command)) {
foreach(string command in ExternalCommandConfig.Commands) {
if (!IsCommandValid(command)) {
commandsToDelete.Add(command);
}
}
// cleanup
foreach (string command in commandsToDelete) {
config.runInbackground.Remove(command);
config.commandlines.Remove(command);
config.arguments.Remove(command);
config.Commands.Remove(command);
ExternalCommandConfig.Delete(command);
}
_host = pluginHost;
@ -128,7 +125,7 @@ namespace ExternalCommand {
PluginUtils.AddToContextMenu(_host, _itemPlugInRoot);
Language.LanguageChanged += OnLanguageChanged;
coreConfig.PropertyChanged += OnIconSizeChanged;
CoreConfig.PropertyChanged += OnIconSizeChanged;
return true;
}
@ -145,7 +142,7 @@ namespace ExternalCommand {
_itemPlugInRoot.Image = PluginUtils.GetCachedExeIcon(exePath, 0);
}
} catch (Exception ex) {
LOG.Warn("Couldn't get the cmd.exe image", ex);
Log.Warn("Couldn't get the cmd.exe image", ex);
}
}
}
@ -157,7 +154,7 @@ namespace ExternalCommand {
}
public virtual void Shutdown() {
LOG.Debug("Shutdown of " + _myAttributes.Name);
Log.Debug("Shutdown of " + _myAttributes.Name);
}
private void ConfigMenuClick(object sender, EventArgs eventArgs) {
@ -168,7 +165,7 @@ namespace ExternalCommand {
/// Implementation of the IPlugin.Configure
/// </summary>
public virtual void Configure() {
LOG.Debug("Configure called");
Log.Debug("Configure called");
new SettingsForm().ShowDialog();
}
}

View file

@ -33,11 +33,11 @@ namespace ExternalCommand {
public static Image IconForCommand(string commandName) {
Image icon = null;
if (commandName != null) {
if (config.commandlines.ContainsKey(commandName) && File.Exists(config.commandlines[commandName])) {
if (config.Commandline.ContainsKey(commandName) && File.Exists(config.Commandline[commandName])) {
try {
icon = PluginUtils.GetCachedExeIcon(config.commandlines[commandName], 0);
icon = PluginUtils.GetCachedExeIcon(config.Commandline[commandName], 0);
} catch (Exception ex) {
LOG.Warn("Problem loading icon for " + config.commandlines[commandName], ex);
LOG.Warn("Problem loading icon for " + config.Commandline[commandName], ex);
}
}
}

View file

@ -29,8 +29,7 @@ namespace ExternalCommand {
/// Description of SettingsForm.
/// </summary>
public partial class SettingsForm : ExternalCommandForm {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(SettingsForm));
private static readonly ExternalCommandConfiguration config = IniConfig.GetIniSection<ExternalCommandConfiguration>();
private static readonly ExternalCommandConfiguration ExternalCommandConfig = IniConfig.GetIniSection<ExternalCommandConfiguration>();
public SettingsForm() {
//
@ -42,35 +41,34 @@ namespace ExternalCommand {
UpdateView();
}
void ButtonOkClick(object sender, EventArgs e) {
private void ButtonOkClick(object sender, EventArgs e) {
IniConfig.Save();
}
void ButtonAddClick(object sender, EventArgs e) {
SettingsFormDetail form = new SettingsFormDetail(null);
private void ButtonAddClick(object sender, EventArgs e) {
var form = new SettingsFormDetail(null);
form.ShowDialog();
UpdateView();
}
void ButtonDeleteClick(object sender, EventArgs e) {
private void ButtonDeleteClick(object sender, EventArgs e) {
foreach(ListViewItem item in listView1.SelectedItems) {
string commando = item.Tag as string;
config.Commands.Remove(commando);
config.commandlines.Remove(commando);
config.arguments.Remove(commando);
ExternalCommandConfig.Delete(commando);
}
UpdateView();
}
void UpdateView() {
private void UpdateView() {
listView1.Items.Clear();
if(config.Commands != null) {
if(ExternalCommandConfig.Commands != null) {
listView1.ListViewItemSorter = new ListviewComparer();
ImageList imageList = new ImageList();
listView1.SmallImageList = imageList;
int imageNr = 0;
foreach(string commando in config.Commands) {
foreach(string commando in ExternalCommandConfig.Commands) {
ListViewItem item;
Image iconForExe = IconCache.IconForCommand(commando);
if(iconForExe != null) {
@ -87,15 +85,15 @@ namespace ExternalCommand {
button_edit.Enabled = listView1.SelectedItems.Count > 0;
}
void ListView1ItemSelectionChanged(object sender, EventArgs e) {
private void ListView1ItemSelectionChanged(object sender, EventArgs e) {
button_edit.Enabled = listView1.SelectedItems.Count > 0;
}
void ButtonEditClick(object sender, EventArgs e) {
private void ButtonEditClick(object sender, EventArgs e) {
ListView1DoubleClick(sender, e);
}
void ListView1DoubleClick(object sender, EventArgs e) {
private void ListView1DoubleClick(object sender, EventArgs e) {
// Safety check for bug #1484
bool selectionActive = listView1.SelectedItems.Count > 0;
if(!selectionActive) {
@ -104,7 +102,7 @@ namespace ExternalCommand {
}
string commando = listView1.SelectedItems[0].Tag as string;
SettingsFormDetail form = new SettingsFormDetail(commando);
var form = new SettingsFormDetail(commando);
form.ShowDialog();
UpdateView();
@ -120,12 +118,9 @@ namespace ExternalCommand {
return (0);
}
ListViewItem l1 = (ListViewItem)x;
ListViewItem l2 = (ListViewItem)y;
if(l2 == null) {
return 1;
}
return l1.Text.CompareTo(l2.Text);
var l1 = (ListViewItem)x;
var l2 = (ListViewItem)y;
return string.Compare(l1.Text, l2.Text, StringComparison.Ordinal);
}
}
}

View file

@ -45,8 +45,8 @@ namespace ExternalCommand {
if(commando != null) {
textBox_name.Text = commando;
textBox_commandline.Text = config.commandlines[commando];
textBox_arguments.Text = config.arguments[commando];
textBox_commandline.Text = config.Commandline[commando];
textBox_arguments.Text = config.Argument[commando];
_commandIndex = config.Commands.FindIndex(delegate(string s) { return s == commando; });
} else {
textBox_arguments.Text = "\"{0}\"";
@ -54,25 +54,25 @@ namespace ExternalCommand {
OkButtonState();
}
void ButtonOkClick(object sender, EventArgs e) {
private void ButtonOkClick(object sender, EventArgs e) {
string commandName = textBox_name.Text;
string commandLine = textBox_commandline.Text;
string arguments = textBox_arguments.Text;
if(_commando != null) {
config.Commands[_commandIndex] = commandName;
config.commandlines.Remove(_commando);
config.commandlines.Add(commandName, commandLine);
config.arguments.Remove(_commando);
config.arguments.Add(commandName, arguments);
config.Commandline.Remove(_commando);
config.Commandline.Add(commandName, commandLine);
config.Argument.Remove(_commando);
config.Argument.Add(commandName, arguments);
} else {
config.Commands.Add(commandName);
config.commandlines.Add(commandName, commandLine);
config.arguments.Add(commandName, arguments);
config.Commandline.Add(commandName, commandLine);
config.Argument.Add(commandName, arguments);
}
}
void Button3Click(object sender, EventArgs e) {
OpenFileDialog openFileDialog = new OpenFileDialog
private void Button3Click(object sender, EventArgs e) {
var openFileDialog = new OpenFileDialog
{
Filter = "Executables (*.exe, *.bat, *.com)|*.exe; *.bat; *.com|All files (*)|*",
FilterIndex = 1,

View file

@ -201,7 +201,7 @@ namespace GreenshotImgurPlugin {
}
void ImgurHistoryFormClosing(object sender, FormClosingEventArgs e)
private void ImgurHistoryFormClosing(object sender, FormClosingEventArgs e)
{
_instance = null;
}

View file

@ -42,7 +42,7 @@ namespace GreenshotImgurPlugin {
}
}
void ButtonHistoryClick(object sender, EventArgs e) {
private void ButtonHistoryClick(object sender, EventArgs e) {
ImgurHistory.ShowHistory();
}
}

View file

@ -34,12 +34,12 @@
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="Dapplo.HttpExtensions, Version=0.5.33.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.HttpExtensions.0.5.33\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
<Reference Include="Dapplo.HttpExtensions, Version=0.5.36.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.HttpExtensions.0.5.36\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Dapplo.Jira, Version=0.1.59.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Jira.0.1.59\lib\net45\Dapplo.Jira.dll</HintPath>
<Reference Include="Dapplo.Jira, Version=0.1.61.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Jira.0.1.61\lib\net45\Dapplo.Jira.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Dapplo.Log.Facade, Version=0.5.4.0, Culture=neutral, processorArchitecture=MSIL">

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Dapplo.HttpExtensions" version="0.5.33" targetFramework="net45" />
<package id="Dapplo.Jira" version="0.1.59" targetFramework="net45" />
<package id="Dapplo.HttpExtensions" version="0.5.36" targetFramework="net45" />
<package id="Dapplo.Jira" version="0.1.61" targetFramework="net45" />
<package id="Dapplo.Log.Facade" version="0.5.4" targetFramework="net45" />
<package id="LibZ.Tool" version="1.2.0.0" targetFramework="net45" />
<package id="Svg" version="2.2.1" targetFramework="net45" />

View file

@ -54,7 +54,7 @@ namespace GreenshotOCR {
}
}
void ButtonOKClick(object sender, EventArgs e) {
private void ButtonOKClick(object sender, EventArgs e) {
string selectedString = (string) comboBox_languages.SelectedItem;
if (selectedString != null) {
config.Language = selectedString.ToUpper();

View file

@ -22,7 +22,7 @@ using System;
using System.Runtime.InteropServices;
namespace Greenshot.Interop.Office {
enum PT : uint {
internal enum PT : uint {
PT_UNSPECIFIED = 0, /* (Reserved for interface use) type doesn't matter to caller */
PT_NULL = 1, /* NULL property value */
PT_I2 = 2, /* Signed 16-bit value */
@ -470,7 +470,7 @@ namespace Greenshot.Interop.Office {
[ComImport()]
[Guid(IID_IMAPIProp)]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
interface IMessage : IMAPIProp {
private interface IMessage : IMAPIProp {
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int GetAttachmentTable();
@ -558,7 +558,7 @@ namespace Greenshot.Interop.Office {
[ComImport()]
[Guid(IID_IMAPIProp)]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
interface IMAPIProp {
private interface IMAPIProp {
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int GetLastError();

View file

@ -110,7 +110,7 @@ namespace GreenshotPlugin.Controls {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void timer_Tick(object sender, EventArgs e) {
private void timer_Tick(object sender, EventArgs e) {
try {
Animate();
} catch (Exception ex) {

View file

@ -93,7 +93,7 @@ namespace GreenshotPlugin.Controls {
Application.DoEvents();
}
void BackgroundFormFormClosing(object sender, FormClosingEventArgs e) {
private void BackgroundFormFormClosing(object sender, FormClosingEventArgs e) {
timer_checkforclose.Stop();
}
}

View file

@ -25,14 +25,14 @@ using GreenshotInterop.Interop;
namespace GreenshotPlugin.Controls {
public class ExtendedWebBrowser : WebBrowser {
protected class ExtendedWebBrowserSite : WebBrowserSite, IOleCommandTarget {
const int OLECMDID_SHOWSCRIPTERROR = 40;
const int OLECMDID_SHOWMESSAGE = 41;
private const int OLECMDID_SHOWSCRIPTERROR = 40;
private const int OLECMDID_SHOWMESSAGE = 41;
static readonly Guid CGID_DocHostCommandHandler = new Guid("F38BC242-B950-11D1-8918-00C04FC2C836");
private static readonly Guid CGID_DocHostCommandHandler = new Guid("F38BC242-B950-11D1-8918-00C04FC2C836");
const int S_OK = 0;
const int OLECMDERR_E_NOTSUPPORTED = (-2147221248);
const int OLECMDERR_E_UNKNOWNGROUP = (-2147221244);
private const int S_OK = 0;
private const int OLECMDERR_E_NOTSUPPORTED = (-2147221248);
private const int OLECMDERR_E_UNKNOWNGROUP = (-2147221244);
public ExtendedWebBrowserSite(WebBrowser wb) : base(wb) {
}

View file

@ -201,7 +201,7 @@ namespace GreenshotPlugin.Controls {
/// Fires when a key is pushed down. Here, we'll want to update the text in the box
/// to notify the user what combination is currently pressed.
/// </summary>
void HotkeyControl_KeyDown(object sender, KeyEventArgs e) {
private void HotkeyControl_KeyDown(object sender, KeyEventArgs e) {
// Clear the current hotkey
if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete) {
ResetHotkey();
@ -217,7 +217,7 @@ namespace GreenshotPlugin.Controls {
/// Fires when all keys are released. If the current hotkey isn't valid, reset it.
/// Otherwise, do nothing and keep the text and hotkey as it was.
/// </summary>
void HotkeyControl_KeyUp(object sender, KeyEventArgs e) {
private void HotkeyControl_KeyUp(object sender, KeyEventArgs e) {
// Somehow the PrintScreen only comes as a keyup, therefore we handle it here.
if (e.KeyCode == Keys.PrintScreen) {
_modifiers = e.Modifiers;
@ -235,7 +235,7 @@ namespace GreenshotPlugin.Controls {
/// Prevents the letter/whatever entered to show up in the TextBox
/// Without this, a "A" key press would appear as "aControl, Alt + A"
/// </summary>
void HotkeyControl_KeyPress(object sender, KeyPressEventArgs e) {
private void HotkeyControl_KeyPress(object sender, KeyPressEventArgs e) {
e.Handled = true;
}

View file

@ -115,7 +115,7 @@ namespace GreenshotPlugin.Controls {
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void CancelButtonClick(object sender, EventArgs e) {
private void CancelButtonClick(object sender, EventArgs e) {
LOG.DebugFormat("Cancel clicked on {0}", _title);
cancelButton.Enabled = false;
_waitFor.Abort();

View file

@ -49,7 +49,7 @@ namespace GreenshotPlugin.Controls {
ToFront = true;
}
void Button_okClick(object sender, EventArgs e) {
private void Button_okClick(object sender, EventArgs e) {
Settings.JPGQuality = trackBarJpegQuality.Value;
Settings.ReduceColors = checkBox_reduceColors.Checked;
if (checkbox_dontaskagain.Checked) {
@ -60,7 +60,7 @@ namespace GreenshotPlugin.Controls {
}
}
void TrackBarJpegQualityScroll(object sender, EventArgs e) {
private void TrackBarJpegQualityScroll(object sender, EventArgs e) {
textBoxJpegQuality.Text = trackBarJpegQuality.Value.ToString();
}
}

View file

@ -519,7 +519,7 @@ namespace GreenshotPlugin.Core {
throw new NotImplementedException();
}
static class Sine {
private static class Sine {
public static double EaseIn(double s) {
return Math.Sin(s * (Math.PI / 2) - (Math.PI / 2)) + 1;
}
@ -531,7 +531,7 @@ namespace GreenshotPlugin.Core {
}
}
static class Power {
private static class Power {
public static double EaseIn(double s, int power) {
return Math.Pow(s, power);
}

View file

@ -490,7 +490,7 @@ namespace GreenshotPlugin.Core {
/// <returns>Bitmap</returns>
public static Image ApplyEffect(Image sourceImage, IEffect effect, Matrix matrix)
{
List<IEffect> effects = new List<IEffect> { effect };
var effects = new List<IEffect> { effect };
return ApplyEffects(sourceImage, effects, matrix);
}
@ -501,13 +501,13 @@ namespace GreenshotPlugin.Core {
/// <param name="effects">List of IEffect</param>
/// <param name="matrix"></param>
/// <returns>Bitmap</returns>
public static Image ApplyEffects(Image sourceImage, List<IEffect> effects, Matrix matrix)
public static Image ApplyEffects(Image sourceImage, IEnumerable<IEffect> effects, Matrix matrix)
{
Image currentImage = sourceImage;
var currentImage = sourceImage;
bool disposeImage = false;
foreach (IEffect effect in effects)
foreach (var effect in effects)
{
Image tmpImage = effect.Apply(currentImage, matrix);
var tmpImage = effect.Apply(currentImage, matrix);
if (tmpImage != null)
{
if (disposeImage)
@ -515,7 +515,6 @@ namespace GreenshotPlugin.Core {
currentImage.Dispose();
}
currentImage = tmpImage;
tmpImage = null;
// Make sure the "new" image is disposed
disposeImage = true;
}
@ -549,7 +548,7 @@ namespace GreenshotPlugin.Core {
public static Image CreateTornEdge(Image sourceImage, int toothHeight, int horizontalToothRange, int verticalToothRange, bool[] edges)
{
Image returnImage = CreateEmpty(sourceImage.Width, sourceImage.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceImage.HorizontalResolution, sourceImage.VerticalResolution);
using (GraphicsPath path = new GraphicsPath())
using (var path = new GraphicsPath())
{
Random random = new Random();
int horizontalRegions = (int)Math.Round((float)sourceImage.Width / horizontalToothRange);

View file

@ -780,7 +780,7 @@ namespace GreenshotPlugin.Core {
}
if (windowRect.IsEmpty) {
if (GetWindowRect(out windowRect))
if (!GetWindowRect(out windowRect))
{
Win32Error error = Win32.GetLastErrorCode();
Log.WarnFormat("Couldn't retrieve the windows rectangle: {0}", Win32.GetMessage(error));

View file

@ -64,10 +64,10 @@ namespace Greenshot.Interop {
#endregion
[DllImport("ole32.dll")]
static extern int ProgIDFromCLSID([In] ref Guid clsid, [MarshalAs(UnmanagedType.LPWStr)] out string lplpszProgId);
private static extern int ProgIDFromCLSID([In] ref Guid clsid, [MarshalAs(UnmanagedType.LPWStr)] out string lplpszProgId);
// Converts failure HRESULTs to exceptions:
[DllImport("oleaut32", PreserveSig=false)]
static extern void GetActiveObject(ref Guid rclsid, IntPtr pvReserved, [MarshalAs(UnmanagedType.IUnknown)] out object ppunk);
private static extern void GetActiveObject(ref Guid rclsid, IntPtr pvReserved, [MarshalAs(UnmanagedType.IUnknown)] out object ppunk);
#region Construction

View file

@ -90,7 +90,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static class Win32 {
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
static extern uint FormatMessage(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, [Out] StringBuilder lpBuffer, int nSize, IntPtr Arguments);
private static extern uint FormatMessage(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, [Out] StringBuilder lpBuffer, int nSize, IntPtr Arguments);
[DllImport("kernel32.dll")]
public static extern void SetLastError(uint dwErrCode);