diff --git a/Greenshot/Destinations/EditorDestination.cs b/Greenshot/Destinations/EditorDestination.cs
index d5214eabc..e192d7ff3 100644
--- a/Greenshot/Destinations/EditorDestination.cs
+++ b/Greenshot/Destinations/EditorDestination.cs
@@ -55,9 +55,8 @@ namespace Greenshot.Destinations {
get {
if (editor == null) {
return Language.GetString(LangKey.settings_destination_editor);
- } else {
- return Language.GetString(LangKey.settings_destination_editor) + " - " + editor.CaptureDetails.Title;
}
+ return Language.GetString(LangKey.settings_destination_editor) + " - " + editor.CaptureDetails.Title;
}
}
diff --git a/Greenshot/Destinations/PrinterDestination.cs b/Greenshot/Destinations/PrinterDestination.cs
index b1867e74f..c98fafce7 100644
--- a/Greenshot/Destinations/PrinterDestination.cs
+++ b/Greenshot/Destinations/PrinterDestination.cs
@@ -57,9 +57,8 @@ namespace Greenshot.Destinations {
get {
if (printerName != null) {
return Language.GetString(LangKey.settings_destination_printer) + " - " + printerName;
- } else {
- return Language.GetString(LangKey.settings_destination_printer);
}
+ return Language.GetString(LangKey.settings_destination_printer);
}
}
diff --git a/Greenshot/Drawing/ArrowContainer.cs b/Greenshot/Drawing/ArrowContainer.cs
index 2708a2c9e..9958271ad 100644
--- a/Greenshot/Drawing/ArrowContainer.cs
+++ b/Greenshot/Drawing/ArrowContainer.cs
@@ -108,9 +108,8 @@ namespace Greenshot.Drawing {
return drawingBounds;
}
}
- } else {
- return Rectangle.Empty;
}
+ return Rectangle.Empty;
}
}
@@ -125,9 +124,8 @@ namespace Greenshot.Drawing {
return path.IsOutlineVisible(x, y, pen);
}
}
- } else {
- return false;
}
+ return false;
}
}
}
diff --git a/Greenshot/Drawing/CursorContainer.cs b/Greenshot/Drawing/CursorContainer.cs
index 5fca847be..050ab31ae 100644
--- a/Greenshot/Drawing/CursorContainer.cs
+++ b/Greenshot/Drawing/CursorContainer.cs
@@ -31,7 +31,7 @@ namespace Greenshot.Drawing {
///
/// Description of CursorContainer.
///
- [Serializable()]
+ [Serializable]
public class CursorContainer : DrawableContainer, ICursorContainer {
private static ILog LOG = LogManager.GetLogger(typeof(CursorContainer));
@@ -73,22 +73,24 @@ namespace Greenshot.Drawing {
}
public void Load(string filename) {
- if (File.Exists(filename)) {
- using (Cursor fileCursor = new Cursor(filename)) {
- Cursor = fileCursor;
- LOG.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width);
- }
+ if (!File.Exists(filename)) {
+ return;
+ }
+ using (Cursor fileCursor = new Cursor(filename)) {
+ Cursor = fileCursor;
+ LOG.Debug("Loaded file: " + filename + " with resolution: " + Height + "," + Width);
}
}
public override void Draw(Graphics graphics, RenderMode rm) {
- if (cursor != null) {
- graphics.SmoothingMode = SmoothingMode.HighQuality;
- graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
- graphics.CompositingQuality = CompositingQuality.Default;
- graphics.PixelOffsetMode = PixelOffsetMode.None;
- cursor.DrawStretched(graphics, Bounds);
+ if (cursor == null) {
+ return;
}
+ graphics.SmoothingMode = SmoothingMode.HighQuality;
+ graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
+ graphics.CompositingQuality = CompositingQuality.Default;
+ graphics.PixelOffsetMode = PixelOffsetMode.None;
+ cursor.DrawStretched(graphics, Bounds);
}
public override Size DefaultSize {
diff --git a/Greenshot/Drawing/DrawableContainer.cs b/Greenshot/Drawing/DrawableContainer.cs
index 65d30914f..39a294fa1 100644
--- a/Greenshot/Drawing/DrawableContainer.cs
+++ b/Greenshot/Drawing/DrawableContainer.cs
@@ -225,14 +225,14 @@ namespace Greenshot.Drawing {
private int round(float f) {
if(float.IsPositiveInfinity(f) || f>int.MaxValue/2) return int.MaxValue/2;
- else if (float.IsNegativeInfinity(f) || fint.MaxValue/2) return int.MaxValue/2;
- else if (Double.IsNegativeInfinity(d) || d
/// Dispatches most of a DrawableContainer's public properties and methods to a list of DrawableContainers.
///
- [Serializable()]
+ [Serializable]
public class DrawableContainerList : List {
- private static CoreConfiguration conf = IniConfig.GetIniSection();
- private static ComponentResourceManager editorFormResources = new ComponentResourceManager(typeof(ImageEditorForm));
+ private static readonly ComponentResourceManager editorFormResources = new ComponentResourceManager(typeof(ImageEditorForm));
public Guid ParentID {
get;
@@ -58,7 +56,7 @@ namespace Greenshot.Drawing {
return this[Count-1].Status;
}
set {
- foreach (DrawableContainer dc in this) {
+ foreach (var dc in this) {
dc.Status = value;
}
}
@@ -79,13 +77,13 @@ namespace Greenshot.Drawing {
public bool Selected {
get {
bool ret = true;
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
ret &= dc.Selected;
}
return ret;
}
set {
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
dc.Selected = value;
}
}
@@ -104,7 +102,8 @@ namespace Greenshot.Drawing {
}
set {
ParentID = value.ID;
- foreach(DrawableContainer dc in this) {
+ foreach(var drawableContainer in this) {
+ var dc = (DrawableContainer) drawableContainer;
dc.Parent = value;
}
}
@@ -137,7 +136,7 @@ namespace Greenshot.Drawing {
// Invalidate before moving, otherwise the old locations aren't refreshed
Invalidate();
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
dc.Left += dx;
dc.Top += dy;
modified = true;
@@ -155,7 +154,7 @@ namespace Greenshot.Drawing {
/// Hides the grippers of all elements in the list.
///
public void HideGrippers() {
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
dc.HideGrippers();
dc.Invalidate();
}
@@ -165,7 +164,7 @@ namespace Greenshot.Drawing {
/// Shows the grippers of all elements in the list.
///
public void ShowGrippers() {
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
dc.ShowGrippers();
dc.Invalidate();
}
@@ -179,7 +178,7 @@ namespace Greenshot.Drawing {
/// true if one of the elements in the list is clickable at the given location, false otherwise
public bool ClickableAt(int x, int y) {
bool ret = false;
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
ret |= dc.ClickableAt(x, y);
}
return ret;
@@ -204,7 +203,8 @@ namespace Greenshot.Drawing {
/// Dispatches OnDoubleClick to all elements in the list.
///
public void OnDoubleClick() {
- foreach(DrawableContainer dc in this) {
+ foreach(var drawableContainer in this) {
+ var dc = (DrawableContainer) drawableContainer;
dc.OnDoubleClick();
}
}
@@ -214,8 +214,8 @@ namespace Greenshot.Drawing {
///
///
/// true if an filter intersects
- public bool hasIntersectingFilters(Rectangle clipRectangle) {
- foreach(DrawableContainer dc in this) {
+ public bool HasIntersectingFilters(Rectangle clipRectangle) {
+ foreach(var dc in this) {
if (dc.DrawingBounds.IntersectsWith(clipRectangle) && dc.hasFilters && dc.Status == EditStatus.IDLE) {
return true;
}
@@ -229,7 +229,7 @@ namespace Greenshot.Drawing {
///
///
public bool IntersectsWith(Rectangle clipRectangle) {
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
if (dc.DrawingBounds.IntersectsWith(clipRectangle)) {
return true;
}
@@ -240,10 +240,13 @@ namespace Greenshot.Drawing {
///
/// Triggers all elements in the list ot be redrawn.
///
- /// the related Graphics object
+ /// the to the bitmap related Graphics object
+ /// Bitmap to draw
/// the rendermode in which the element is to be drawn
+ ///
public void Draw(Graphics g, Bitmap bitmap, RenderMode renderMode, Rectangle clipRectangle) {
- foreach(DrawableContainer dc in this) {
+ foreach(var drawableContainer in this) {
+ var dc = (DrawableContainer) drawableContainer;
if (dc.DrawingBounds.IntersectsWith(clipRectangle)) {
dc.DrawContent(g, bitmap, renderMode, clipRectangle);
}
@@ -256,7 +259,8 @@ namespace Greenshot.Drawing {
///
///
public void HandleFieldChangedEvent(object sender, FieldChangedEventArgs e) {
- foreach(DrawableContainer dc in this) {
+ foreach(var drawableContainer in this) {
+ var dc = (DrawableContainer) drawableContainer;
dc.HandleFieldChanged(sender, e);
}
}
@@ -265,7 +269,7 @@ namespace Greenshot.Drawing {
/// Invalidate the bounds of all the DC's in this list
///
public void Invalidate() {
- foreach(DrawableContainer dc in this) {
+ foreach(var dc in this) {
dc.Invalidate();
}
}
@@ -279,7 +283,7 @@ namespace Greenshot.Drawing {
if (elements.Count == 0 || elements.Count == Count) {
return false;
}
- foreach(DrawableContainer element in elements) {
+ foreach(var element in elements) {
if (IndexOf(element) < Count - elements.Count) {
return true;
}
@@ -293,11 +297,12 @@ namespace Greenshot.Drawing {
/// list of elements to pull up
public void PullElementsUp(DrawableContainerList elements) {
for(int i=Count-1; i>=0; i--) {
- IDrawableContainer dc = this[i];
- if (elements.Contains(dc)) {
- if (Count > (i+1) && !elements.Contains(this[i+1])) {
- SwapElements(i,i+1);
- }
+ var dc = this[i];
+ if (!elements.Contains(dc)) {
+ continue;
+ }
+ if (Count > (i+1) && !elements.Contains(this[i+1])) {
+ SwapElements(i,i+1);
}
}
}
@@ -307,14 +312,15 @@ namespace Greenshot.Drawing {
///
/// of elements to pull to top
public void PullElementsToTop(DrawableContainerList elements) {
- IDrawableContainer[] dcs = ToArray();
+ var dcs = ToArray();
for(int i=0; i= elements.Count) {
return true;
}
@@ -342,11 +348,12 @@ namespace Greenshot.Drawing {
/// list of elements to push down
public void PushElementsDown(DrawableContainerList elements) {
for(int i=0; i0) && !elements.Contains(this[i-1])) {
- SwapElements(i,i-1);
- }
+ var dc = this[i];
+ if (!elements.Contains(dc)) {
+ continue;
+ }
+ if((i>0) && !elements.Contains(this[i-1])) {
+ SwapElements(i,i-1);
}
}
}
@@ -356,14 +363,15 @@ namespace Greenshot.Drawing {
///
/// of elements to push to bottom
public void PushElementsToBottom(DrawableContainerList elements) {
- IDrawableContainer[] dcs = ToArray();
+ var dcs = ToArray();
for(int i=dcs.Length-1; i>=0; i--) {
- IDrawableContainer dc = dcs[i];
- if(elements.Contains(dc)) {
- Remove(dc);
- Insert(0, dc);
- Parent.Modified = true;
+ var dc = dcs[i];
+ if (!elements.Contains(dc)) {
+ continue;
}
+ Remove(dc);
+ Insert(0, dc);
+ Parent.Modified = true;
}
}
@@ -374,18 +382,20 @@ namespace Greenshot.Drawing {
/// index of the 1st element
/// index of the 2nd element
private void SwapElements(int index1, int index2) {
- if(index1 >= 0 && index1 < Count && index2 >= 0 && index2 < Count && index1 != index2) {
- IDrawableContainer dc = this[index1];
- this[index1] = this[index2];
- this[index2] = dc;
- Parent.Modified = true;
+ if (index1 < 0 || index1 >= Count || index2 < 0 || index2 >= Count || index1 == index2) {
+ return;
}
+ var dc = this[index1];
+ this[index1] = this[index2];
+ this[index2] = dc;
+ Parent.Modified = true;
}
///
/// Add items to a context menu for the selected item
///
///
+ ///
public virtual void AddContextMenuItems(ContextMenuStrip menu, Surface surface) {
bool push = surface.Elements.CanPushDown(this);
bool pull = surface.Elements.CanPullUp(this);
@@ -449,10 +459,11 @@ namespace Greenshot.Drawing {
item.Click += delegate {
ClipboardHelper.SetClipboardData(typeof(DrawableContainerList), this);
List containersToDelete = new List();
- foreach (DrawableContainer container in this) {
+ foreach (var drawableContainer in this) {
+ var container = (DrawableContainer) drawableContainer;
containersToDelete.Add(container);
}
- foreach (DrawableContainer container in containersToDelete) {
+ foreach (var container in containersToDelete) {
surface.RemoveElement(container, true);
}
};
@@ -463,7 +474,8 @@ namespace Greenshot.Drawing {
item.Image = ((Image)(editorFormResources.GetObject("removeObjectToolStripMenuItem.Image")));
item.Click += delegate {
List containersToDelete = new List();
- foreach(DrawableContainer container in this) {
+ foreach(var drawableContainer in this) {
+ var container = (DrawableContainer) drawableContainer;
containersToDelete.Add(container);
}
foreach (DrawableContainer container in containersToDelete) {
@@ -474,7 +486,8 @@ namespace Greenshot.Drawing {
// Reset
bool canReset = false;
- foreach (DrawableContainer container in this) {
+ foreach (var drawableContainer in this) {
+ var container = (DrawableContainer) drawableContainer;
if (container.hasDefaultSize) {
canReset = true;
}
@@ -483,15 +496,17 @@ namespace Greenshot.Drawing {
item = new ToolStripMenuItem(Language.GetString(LangKey.editor_resetsize));
//item.Image = ((System.Drawing.Image)(editorFormResources.GetObject("removeObjectToolStripMenuItem.Image")));
item.Click += delegate {
- foreach (DrawableContainer container in this) {
- if (container.hasDefaultSize) {
- Size defaultSize = container.DefaultSize;
- container.Invalidate();
- container.MakeBoundsChangeUndoable(false);
- container.Width = defaultSize.Width;
- container.Height = defaultSize.Height;
- container.Invalidate();
+ foreach (var drawableContainer in this) {
+ var container = (DrawableContainer) drawableContainer;
+ if (!container.hasDefaultSize) {
+ continue;
}
+ Size defaultSize = container.DefaultSize;
+ container.Invalidate();
+ container.MakeBoundsChangeUndoable(false);
+ container.Width = defaultSize.Width;
+ container.Height = defaultSize.Height;
+ container.Invalidate();
}
};
menu.Items.Add(item);
@@ -500,11 +515,13 @@ namespace Greenshot.Drawing {
public virtual void ShowContextMenu(MouseEventArgs e, Surface surface) {
bool hasMenu = false;
- foreach (DrawableContainer container in this) {
- if (container.hasContextMenu) {
- hasMenu = true;
- break;
+ foreach (var drawableContainer in this) {
+ var container = (DrawableContainer) drawableContainer;
+ if (!container.hasContextMenu) {
+ continue;
}
+ hasMenu = true;
+ break;
}
if (hasMenu) {
ContextMenuStrip menu = new ContextMenuStrip();
diff --git a/Greenshot/Drawing/EllipseContainer.cs b/Greenshot/Drawing/EllipseContainer.cs
index 2c0eb8859..ca1a3f5ed 100644
--- a/Greenshot/Drawing/EllipseContainer.cs
+++ b/Greenshot/Drawing/EllipseContainer.cs
@@ -107,9 +107,8 @@ namespace Greenshot.Drawing {
return path.IsOutlineVisible(x, y, pen);
}
}
- } else {
- return false;
}
+ return false;
}
}
}
diff --git a/Greenshot/Drawing/Fields/Binding/AbstractBindingConverter.cs b/Greenshot/Drawing/Fields/Binding/AbstractBindingConverter.cs
index 0e6222834..f99ba7944 100644
--- a/Greenshot/Drawing/Fields/Binding/AbstractBindingConverter.cs
+++ b/Greenshot/Drawing/Fields/Binding/AbstractBindingConverter.cs
@@ -31,15 +31,16 @@ namespace Greenshot.Drawing.Fields.Binding {
public object convert(object o) {
if(o == null) {
return null;
- } else if(o is T1) {
- return convert((T1)o);
- } else if(o is T2) {
- return convert((T2)o);
- } else {
- throw new ArgumentException("Cannot handle argument of type "+o.GetType());
}
+ if(o is T1) {
+ return convert((T1)o);
+ }
+ if(o is T2) {
+ return convert((T2)o);
+ }
+ throw new ArgumentException("Cannot handle argument of type "+o.GetType());
}
-
+
protected abstract T2 convert(T1 o);
protected abstract T1 convert(T2 o);
diff --git a/Greenshot/Drawing/FreehandContainer.cs b/Greenshot/Drawing/FreehandContainer.cs
index de955f3ef..2bd060e84 100644
--- a/Greenshot/Drawing/FreehandContainer.cs
+++ b/Greenshot/Drawing/FreehandContainer.cs
@@ -228,9 +228,8 @@ namespace Greenshot.Drawing {
int lineThickness = Math.Max(10, GetFieldValueAsInt(FieldType.LINE_THICKNESS));
int safetymargin = 10;
return new Rectangle((myBounds.Left + Left) - (safetymargin+lineThickness), (myBounds.Top + Top) - (safetymargin+lineThickness), myBounds.Width + (2*(lineThickness+safetymargin)), myBounds.Height + (2*(lineThickness+safetymargin)));
- } else {
- return new Rectangle(0, 0, parent.Width, parent.Height);
}
+ return new Rectangle(0, 0, parent.Width, parent.Height);
}
}
diff --git a/Greenshot/Drawing/HighlightContainer.cs b/Greenshot/Drawing/HighlightContainer.cs
index 188134040..2f4e7fecb 100644
--- a/Greenshot/Drawing/HighlightContainer.cs
+++ b/Greenshot/Drawing/HighlightContainer.cs
@@ -29,34 +29,35 @@ namespace Greenshot.Drawing {
///
/// Description of ObfuscateContainer.
///
- [Serializable()]
+ [Serializable]
public class HighlightContainer : FilterContainer {
public HighlightContainer(Surface parent) : base(parent) {
AddField(GetType(), FieldType.LINE_THICKNESS, 0);
AddField(GetType(), FieldType.LINE_COLOR, Color.Red);
AddField(GetType(), FieldType.SHADOW, false);
AddField(GetType(), FieldType.PREPARED_FILTER_HIGHLIGHT, PreparedFilter.TEXT_HIGHTLIGHT);
- init();
+ Init();
}
- [OnDeserialized()]
+ [OnDeserialized]
private void OnDeserialized(StreamingContext context) {
- init();
+ Init();
}
- private void init() {
+ private void Init() {
FieldChanged += HighlightContainer_OnFieldChanged;
ConfigurePreparedFilters();
}
protected void HighlightContainer_OnFieldChanged(object sender, FieldChangedEventArgs e) {
- if(sender.Equals(this)) {
- if (e.Field.FieldType == FieldType.PREPARED_FILTER_HIGHLIGHT) {
- ConfigurePreparedFilters();
- }
+ if (!sender.Equals(this)) {
+ return;
+ }
+ if (e.Field.FieldType == FieldType.PREPARED_FILTER_HIGHLIGHT) {
+ ConfigurePreparedFilters();
}
}
-
+
private void ConfigurePreparedFilters() {
PreparedFilter preset = (PreparedFilter)GetFieldValue(FieldType.PREPARED_FILTER_HIGHLIGHT);
while(Filters.Count>0) {
diff --git a/Greenshot/Drawing/IconContainer.cs b/Greenshot/Drawing/IconContainer.cs
index 54d36fd82..eb6e1e93a 100644
--- a/Greenshot/Drawing/IconContainer.cs
+++ b/Greenshot/Drawing/IconContainer.cs
@@ -29,7 +29,7 @@ namespace Greenshot.Drawing {
///
/// Description of IconContainer.
///
- [Serializable()]
+ [Serializable]
public class IconContainer : DrawableContainer, IIconContainer {
private static ILog LOG = LogManager.GetLogger(typeof(IconContainer));
diff --git a/Greenshot/Drawing/ImageContainer.cs b/Greenshot/Drawing/ImageContainer.cs
index 1c1a5e3b5..3d115f67e 100644
--- a/Greenshot/Drawing/ImageContainer.cs
+++ b/Greenshot/Drawing/ImageContainer.cs
@@ -32,7 +32,7 @@ namespace Greenshot.Drawing {
///
/// Description of BitmapContainer.
///
- [Serializable()]
+ [Serializable]
public class ImageContainer : DrawableContainer, IImageContainer {
private static ILog LOG = LogManager.GetLogger(typeof(ImageContainer));
@@ -43,14 +43,14 @@ namespace Greenshot.Drawing {
/// Do not serialize, as the shadow is recreated from the original bitmap if it's not available
///
[NonSerialized]
- private Image shadowBitmap = null;
+ private Image _shadowBitmap;
///
/// This is the offset for the shadow version of the bitmap
/// Do not serialize, as the offset is recreated
///
[NonSerialized]
- private Point shadowOffset = new Point(-1, -1);
+ private Point _shadowOffset = new Point(-1, -1);
public ImageContainer(Surface parent, string filename) : this(parent) {
Load(filename);
@@ -72,17 +72,17 @@ namespace Greenshot.Drawing {
public void ChangeShadowField() {
bool shadow = GetFieldValueAsBool(FieldType.SHADOW);
if (shadow) {
- CheckShadow(shadow);
- Width = shadowBitmap.Width;
- Height = shadowBitmap.Height;
- Left = Left - shadowOffset.X;
- Top = Top - shadowOffset.Y;
+ CheckShadow(true);
+ Width = _shadowBitmap.Width;
+ Height = _shadowBitmap.Height;
+ Left = Left - _shadowOffset.X;
+ Top = Top - _shadowOffset.Y;
} else {
Width = image.Width;
Height = image.Height;
- if (shadowBitmap != null) {
- Left = Left + shadowOffset.X;
- Top = Top + shadowOffset.Y;
+ if (_shadowBitmap != null) {
+ Left = Left + _shadowOffset.X;
+ Top = Top + _shadowOffset.Y;
}
}
}
@@ -90,7 +90,7 @@ namespace Greenshot.Drawing {
public Image Image {
set {
// Remove all current bitmaps
- disposeImages();
+ DisposeImages();
image = ImageHelper.Clone(value);
bool shadow = GetFieldValueAsBool(FieldType.SHADOW);
CheckShadow(shadow);
@@ -98,10 +98,10 @@ namespace Greenshot.Drawing {
Width = image.Width;
Height = image.Height;
} else {
- Width = shadowBitmap.Width;
- Height = shadowBitmap.Height;
- Left = Left - shadowOffset.X;
- Top = Top - shadowOffset.Y;
+ Width = _shadowBitmap.Width;
+ Height = _shadowBitmap.Height;
+ Left = Left - _shadowOffset.X;
+ Top = Top - _shadowOffset.Y;
}
}
get { return image; }
@@ -115,22 +115,22 @@ namespace Greenshot.Drawing {
///
protected override void Dispose(bool disposing) {
if (disposing) {
- disposeImages();
+ DisposeImages();
}
image = null;
- shadowBitmap = null;
+ _shadowBitmap = null;
base.Dispose(disposing);
}
- private void disposeImages() {
+ private void DisposeImages() {
if (image != null) {
image.Dispose();
}
- if (shadowBitmap != null) {
- shadowBitmap.Dispose();
+ if (_shadowBitmap != null) {
+ _shadowBitmap.Dispose();
}
image = null;
- shadowBitmap = null;
+ _shadowBitmap = null;
}
///
@@ -153,10 +153,10 @@ namespace Greenshot.Drawing {
///
///
public override void Rotate(RotateFlipType rotateFlipType) {
- Image newImage = ImageHelper.RotateFlip((Bitmap)image, rotateFlipType);
+ Image newImage = ImageHelper.RotateFlip(image, rotateFlipType);
if (newImage != null) {
// Remove all current bitmaps, also the shadow (will be recreated)
- disposeImages();
+ DisposeImages();
image = newImage;
}
base.Rotate(rotateFlipType);
@@ -167,8 +167,8 @@ namespace Greenshot.Drawing {
///
///
private void CheckShadow(bool shadow) {
- if (shadow && shadowBitmap == null) {
- shadowBitmap = ImageHelper.ApplyEffect(image, new DropShadowEffect(), out shadowOffset);
+ if (shadow && _shadowBitmap == null) {
+ _shadowBitmap = ImageHelper.ApplyEffect(image, new DropShadowEffect(), out _shadowOffset);
}
}
@@ -186,8 +186,8 @@ namespace Greenshot.Drawing {
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
if (shadow) {
- CheckShadow(shadow);
- graphics.DrawImage(shadowBitmap, Bounds);
+ CheckShadow(true);
+ graphics.DrawImage(_shadowBitmap, Bounds);
} else {
graphics.DrawImage(image, Bounds);
}
diff --git a/Greenshot/Drawing/LineContainer.cs b/Greenshot/Drawing/LineContainer.cs
index be8ea477f..2fe79cf04 100644
--- a/Greenshot/Drawing/LineContainer.cs
+++ b/Greenshot/Drawing/LineContainer.cs
@@ -104,9 +104,8 @@ namespace Greenshot.Drawing {
return path.IsOutlineVisible(x, y, pen);
}
}
- } else {
- return false;
}
+ return false;
}
protected override ScaleHelper.IDoubleProcessor GetAngleRoundProcessor() {
diff --git a/Greenshot/Drawing/ObfuscateContainer.cs b/Greenshot/Drawing/ObfuscateContainer.cs
index c7b189984..572b70c6f 100644
--- a/Greenshot/Drawing/ObfuscateContainer.cs
+++ b/Greenshot/Drawing/ObfuscateContainer.cs
@@ -27,19 +27,19 @@ namespace Greenshot.Drawing {
///
/// Description of ObfuscateContainer.
///
- [Serializable()]
+ [Serializable]
public class ObfuscateContainer : FilterContainer {
public ObfuscateContainer(Surface parent) : base(parent) {
AddField(GetType(), FieldType.PREPARED_FILTER_OBFUSCATE, PreparedFilter.PIXELIZE);
- init();
+ Init();
}
- [OnDeserialized()]
+ [OnDeserialized]
private void OnDeserialized(StreamingContext context) {
- init();
+ Init();
}
- private void init() {
+ private void Init() {
FieldChanged += ObfuscateContainer_OnFieldChanged;
ConfigurePreparedFilters();
}
diff --git a/Greenshot/Drawing/RectangleContainer.cs b/Greenshot/Drawing/RectangleContainer.cs
index 0a20ed6ab..89b555a40 100644
--- a/Greenshot/Drawing/RectangleContainer.cs
+++ b/Greenshot/Drawing/RectangleContainer.cs
@@ -110,9 +110,8 @@ namespace Greenshot.Drawing {
return path.IsOutlineVisible(x, y, pen);
}
}
- } else {
- return false;
}
+ return false;
}
}
}
diff --git a/Greenshot/Drawing/Surface.cs b/Greenshot/Drawing/Surface.cs
index a1bf70d51..c92b90969 100644
--- a/Greenshot/Drawing/Surface.cs
+++ b/Greenshot/Drawing/Surface.cs
@@ -534,9 +534,8 @@ namespace Greenshot.Drawing {
get {
if (CanUndo) {
return undoStack.Peek().ActionLanguageKey;
- } else {
- return LangKey.none;
}
+ return LangKey.none;
}
}
@@ -547,9 +546,8 @@ namespace Greenshot.Drawing {
get {
if (CanRedo) {
return redoStack.Peek().ActionLanguageKey;
- } else {
- return LangKey.none;
}
+ return LangKey.none;
}
}
@@ -1186,7 +1184,7 @@ namespace Greenshot.Drawing {
return;
}
- if (elements.hasIntersectingFilters(clipRectangle)) {
+ if (elements.HasIntersectingFilters(clipRectangle)) {
if (buffer != null) {
if (buffer.Width != Image.Width || buffer.Height != Image.Height || buffer.PixelFormat != Image.PixelFormat) {
buffer.Dispose();
diff --git a/Greenshot/Drawing/TextContainer.cs b/Greenshot/Drawing/TextContainer.cs
index af9dd36fb..fa018963f 100644
--- a/Greenshot/Drawing/TextContainer.cs
+++ b/Greenshot/Drawing/TextContainer.cs
@@ -40,7 +40,7 @@ namespace Greenshot.Drawing {
private bool fontInvalidated = true;
// If makeUndoable is true the next text-change will make the change undoable.
// This is set to true AFTER the first change is made, as there is already a "add element" on the undo stack
- private bool makeUndoable = false;
+ private bool makeUndoable;
private Font font;
///
diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs
index fdc7cbf65..5197593ef 100644
--- a/Greenshot/Forms/MainForm.cs
+++ b/Greenshot/Forms/MainForm.cs
@@ -77,7 +77,11 @@ namespace Greenshot {
LOG.Info("Starting: " + EnvironmentInfo.EnvironmentToString(false));
// Upgrade if needed
- AppConfig.UpgradeToIni();
+ try {
+ AppConfig.UpgradeToIni();
+ } catch {
+ LOG.Warn("Couldn't upgrade the config.dat to geenshot.ini.");
+ }
// Read configuration
_conf = IniConfig.GetIniSection();
@@ -274,7 +278,7 @@ namespace Greenshot {
transport.AddCommand(CommandEnum.FirstLaunch);
}
- new MainForm(transport);
+ _instance = new MainForm(transport);
Application.Run();
} catch(Exception ex) {
LOG.Error("Exception in startup.", ex);
@@ -443,13 +447,15 @@ namespace Greenshot {
notifyIcon.BalloonTipClicked += balloonTipClickedHandler;
notifyIcon.BalloonTipClosed += balloonTipClosedHandler;
notifyIcon.ShowBalloonTip(2000, "Greenshot", Language.GetFormattedString(LangKey.tooltip_firststart, HotkeyControl.GetLocalizedHotkeyStringFromString(_conf.RegionHotkey)), ToolTipIcon.Info);
- } catch {}
+ } catch (Exception ex) {
+ LOG.Warn("Exception while showing first launch: ", ex);
+ }
break;
case CommandEnum.ReloadConfig:
LOG.Info("Reload requested");
try {
IniConfig.Reload();
- Invoke((MethodInvoker)delegate {
+ Invoke((MethodInvoker) delegate {
// Even update language when needed
UpdateUI();
// Update the hotkey
@@ -457,7 +463,9 @@ namespace Greenshot {
HotkeyControl.UnregisterHotkeys();
RegisterHotkeys();
});
- } catch {}
+ } catch (Exception ex) {
+ LOG.Warn("Exception while reloading configuration: ", ex);
+ }
break;
case CommandEnum.OpenFile:
string filename = command.Value;
@@ -508,9 +516,8 @@ namespace Greenshot {
}
failedKeys.Append(hotkeyString);
return false;
- } else {
- LOG.DebugFormat("Registered {0} to hotkey: {1}", functionName, hotkeyString);
}
+ LOG.DebugFormat("Registered {0} to hotkey: {1}", functionName, hotkeyString);
} else {
LOG.InfoFormat("Skipping hotkey registration for {0}, no hotkey set!", functionName);
}
@@ -522,7 +529,7 @@ namespace Greenshot {
try {
bool success = RegisterHotkey(failedKeys, functionName, hotkeyValue.Value.ToString(), handler);
if (!success && ignoreFailedRegistration) {
- LOG.DebugFormat("Ignoring failed hotkey registration, resetting to 'None'.", functionName, hotkeyValue);
+ LOG.DebugFormat("Ignoring failed hotkey registration for {0}, with value '{1}', resetting to 'None'.", functionName, hotkeyValue);
_conf.Values[configurationKey].Value = Keys.None.ToString();
_conf.IsDirty = true;
}
@@ -580,7 +587,9 @@ namespace Greenshot {
success = HandleFailedHotkeyRegistration(failedKeys.ToString());
} else {
// if failures have been ignored, the config has probably been updated
- if (_conf.IsDirty) IniConfig.Save();
+ if (_conf.IsDirty) {
+ IniConfig.Save();
+ }
}
}
return success || ignoreFailedRegistration;
@@ -641,12 +650,8 @@ namespace Greenshot {
CaptureHelper.CaptureRegion(true);
}
- void CaptureClipboard() {
- CaptureHelper.CaptureClipboard();
- }
-
void CaptureFile() {
- OpenFileDialog openFileDialog = new OpenFileDialog();
+ 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) {
if (File.Exists(openFileDialog.FileName)) {
@@ -739,12 +744,7 @@ namespace Greenshot {
title = title.Substring(0, Math.Min(title.Length, _conf.MaxMenuItemLength));
}
ToolStripItem captureIETabItem = contextmenu_captureiefromlist.DropDownItems.Add(title);
- int index;
- if (counter.ContainsKey(tabData.Key)) {
- index = counter[tabData.Key];
- } else {
- index = 0;
- }
+ int index = counter.ContainsKey(tabData.Key) ? counter[tabData.Key] : 0;
captureIETabItem.Image = tabData.Key.DisplayIcon;
captureIETabItem.Tag = new KeyValuePair(tabData.Key, index++);
captureIETabItem.Click += Contextmenu_captureiefromlist_Click;
diff --git a/Greenshot/Help/HelpFileLoader.cs b/Greenshot/Help/HelpFileLoader.cs
index 931e965d3..fe79de7b4 100644
--- a/Greenshot/Help/HelpFileLoader.cs
+++ b/Greenshot/Help/HelpFileLoader.cs
@@ -75,7 +75,7 @@ namespace Greenshot.Help
return res.StatusCode;
} catch(WebException e) {
if(e.Response != null) return ((HttpWebResponse)e.Response).StatusCode;
- else return null;
+ return null;
}
}
}
diff --git a/Greenshot/Helpers/IECaptureHelper.cs b/Greenshot/Helpers/IECaptureHelper.cs
index 1284faa80..76fa0170a 100644
--- a/Greenshot/Helpers/IECaptureHelper.cs
+++ b/Greenshot/Helpers/IECaptureHelper.cs
@@ -278,7 +278,8 @@ namespace Greenshot.Helpers {
returnDocument2 = document2;
returnWindow = new WindowDetails(contentWindowHandle);
break;
- } else if (ieAccessible != null && returnWindow == null && document2.title.Equals(ieAccessible.IEActiveTabCaption) ) {
+ }
+ if (ieAccessible != null && returnWindow == null && document2.title.Equals(ieAccessible.IEActiveTabCaption) ) {
LOG.DebugFormat("Title: {0}", document2.title);
returnDocument2 = document2;
returnWindow = new WindowDetails(contentWindowHandle);
diff --git a/Greenshot/Helpers/PluginHelper.cs b/Greenshot/Helpers/PluginHelper.cs
index ddc443036..1fd7cdcdf 100644
--- a/Greenshot/Helpers/PluginHelper.cs
+++ b/Greenshot/Helpers/PluginHelper.cs
@@ -287,22 +287,21 @@ namespace Greenshot.Helpers {
LOG.InfoFormat("Skipping (as the duplicate is newer or same version) the plugin {0} with version {1} from {2}", pluginAttribute.Name, pluginAttribute.Version, pluginAttribute.DllFile);
}
continue;
- } else {
- if (conf.ExcludePlugins != null && conf.ExcludePlugins.Contains(pluginAttribute.Name)) {
- LOG.WarnFormat("Exclude list: {0}", conf.ExcludePlugins.ToArray());
- LOG.WarnFormat("Skipping the excluded plugin {0} with version {1} from {2}", pluginAttribute.Name, pluginAttribute.Version, pluginAttribute.DllFile);
- continue;
- }
- if (conf.IncludePlugins != null && conf.IncludePlugins.Count > 0 && !conf.IncludePlugins.Contains(pluginAttribute.Name)) {
- // Whitelist is set
- LOG.WarnFormat("Include list: {0}", conf.IncludePlugins.ToArray());
- LOG.WarnFormat("Skipping the not included plugin {0} with version {1} from {2}", pluginAttribute.Name, pluginAttribute.Version, pluginAttribute.DllFile);
- continue;
- }
- LOG.InfoFormat("Loading the plugin {0} with version {1} from {2}", pluginAttribute.Name, pluginAttribute.Version, pluginAttribute.DllFile);
- tmpAttributes[pluginAttribute.Name] = pluginAttribute;
- tmpAssemblies[pluginAttribute.Name] = assembly;
}
+ if (conf.ExcludePlugins != null && conf.ExcludePlugins.Contains(pluginAttribute.Name)) {
+ LOG.WarnFormat("Exclude list: {0}", conf.ExcludePlugins.ToArray());
+ LOG.WarnFormat("Skipping the excluded plugin {0} with version {1} from {2}", pluginAttribute.Name, pluginAttribute.Version, pluginAttribute.DllFile);
+ continue;
+ }
+ if (conf.IncludePlugins != null && conf.IncludePlugins.Count > 0 && !conf.IncludePlugins.Contains(pluginAttribute.Name)) {
+ // Whitelist is set
+ LOG.WarnFormat("Include list: {0}", conf.IncludePlugins.ToArray());
+ LOG.WarnFormat("Skipping the not included plugin {0} with version {1} from {2}", pluginAttribute.Name, pluginAttribute.Version, pluginAttribute.DllFile);
+ continue;
+ }
+ LOG.InfoFormat("Loading the plugin {0} with version {1} from {2}", pluginAttribute.Name, pluginAttribute.Version, pluginAttribute.DllFile);
+ tmpAttributes[pluginAttribute.Name] = pluginAttribute;
+ tmpAssemblies[pluginAttribute.Name] = assembly;
} else {
LOG.ErrorFormat("Can't find the needed Plugin Attribute ({0}) in the assembly of the file \"{1}\", skipping this file.", typeof(PluginAttribute), pluginFile);
}
diff --git a/Greenshot/Helpers/UpdateHelper.cs b/Greenshot/Helpers/UpdateHelper.cs
index d178e035a..49ecf57d3 100644
--- a/Greenshot/Helpers/UpdateHelper.cs
+++ b/Greenshot/Helpers/UpdateHelper.cs
@@ -58,9 +58,8 @@ namespace Greenshot.Experimental {
if (DateTime.Now.CompareTo(checkTime) < 0) {
LOG.DebugFormat("No need to check RSS feed for updates, feed check will be after {0}", checkTime);
return false;
- } else {
- LOG.DebugFormat("Update check is due, last check was {0} check needs to be made after {1} (which is one {2} later)", conf.LastUpdateCheck, checkTime, conf.UpdateCheckInterval);
}
+ LOG.DebugFormat("Update check is due, last check was {0} check needs to be made after {1} (which is one {2} later)", conf.LastUpdateCheck, checkTime, conf.UpdateCheckInterval);
}
}
return true;
diff --git a/GreenshotPlugin/Controls/AnimatingForm.cs b/GreenshotPlugin/Controls/AnimatingForm.cs
index 222ceda44..cdab47653 100644
--- a/GreenshotPlugin/Controls/AnimatingForm.cs
+++ b/GreenshotPlugin/Controls/AnimatingForm.cs
@@ -87,7 +87,7 @@ namespace GreenshotPlugin.Controls {
/// Initialize the animation
///
protected AnimatingForm() {
- this.Load += delegate {
+ Load += delegate {
if (EnableAnimation) {
timer = new Timer();
timer.Interval = 1000 / VRefresh;
@@ -97,7 +97,7 @@ namespace GreenshotPlugin.Controls {
};
// Unregister at close
- this.FormClosing += delegate {
+ FormClosing += delegate {
if (timer != null) {
timer.Stop();
}
diff --git a/GreenshotPlugin/Controls/BackgroundForm.cs b/GreenshotPlugin/Controls/BackgroundForm.cs
index 6e7b264d9..954230945 100644
--- a/GreenshotPlugin/Controls/BackgroundForm.cs
+++ b/GreenshotPlugin/Controls/BackgroundForm.cs
@@ -22,6 +22,7 @@ using System;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
+using GreenshotPlugin.Core;
namespace GreenshotPlugin.Controls {
///
@@ -31,7 +32,7 @@ namespace GreenshotPlugin.Controls {
private volatile bool shouldClose = false;
private void BackgroundShowDialog() {
- this.ShowDialog();
+ ShowDialog();
}
public static BackgroundForm ShowAndWait(string title, string text) {
@@ -50,11 +51,11 @@ namespace GreenshotPlugin.Controls {
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
- this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
+ Icon = GreenshotResources.getGreenshotIcon();
shouldClose = false;
- this.Text = title;
- this.label_pleasewait.Text = text;
- this.FormClosing += PreventFormClose;
+ Text = title;
+ label_pleasewait.Text = text;
+ FormClosing += PreventFormClose;
timer_checkforclose.Start();
}
@@ -65,12 +66,12 @@ namespace GreenshotPlugin.Controls {
foreach(Screen screen in Screen.AllScreens) {
if (screen.Bounds.Contains(Cursor.Position)) {
positioned = true;
- this.Location = new Point(screen.Bounds.X + (screen.Bounds.Width / 2) - (this.Width / 2), screen.Bounds.Y + (screen.Bounds.Height / 2) - (this.Height / 2));
+ Location = new Point(screen.Bounds.X + (screen.Bounds.Width / 2) - (Width / 2), screen.Bounds.Y + (screen.Bounds.Height / 2) - (Height / 2));
break;
}
}
if (!positioned) {
- this.Location = new Point(Cursor.Position.X - this.Width / 2, Cursor.Position.Y - this.Height / 2);
+ Location = new Point(Cursor.Position.X - Width / 2, Cursor.Position.Y - Height / 2);
}
}
@@ -83,7 +84,7 @@ namespace GreenshotPlugin.Controls {
private void Timer_checkforcloseTick(object sender, EventArgs e) {
if (shouldClose) {
timer_checkforclose.Stop();
- this.BeginInvoke(new EventHandler( delegate {this.Close();}));
+ BeginInvoke(new EventHandler( delegate {Close();}));
}
}
diff --git a/GreenshotPlugin/Controls/GreenshotComboBox.cs b/GreenshotPlugin/Controls/GreenshotComboBox.cs
index e3a516534..5aaab253e 100644
--- a/GreenshotPlugin/Controls/GreenshotComboBox.cs
+++ b/GreenshotPlugin/Controls/GreenshotComboBox.cs
@@ -45,7 +45,7 @@ namespace GreenshotPlugin.Controls {
}
public GreenshotComboBox() {
- this.SelectedIndexChanged += delegate {
+ SelectedIndexChanged += delegate {
StoreSelectedEnum();
};
}
@@ -53,7 +53,7 @@ namespace GreenshotPlugin.Controls {
public void SetValue(Enum currentValue) {
if (currentValue != null) {
selectedEnum = currentValue;
- this.SelectedItem = Language.Translate(currentValue);
+ SelectedItem = Language.Translate(currentValue);
}
}
@@ -67,10 +67,10 @@ namespace GreenshotPlugin.Controls {
this.enumType = enumType;
var availableValues = Enum.GetValues(enumType);
- this.Items.Clear();
+ Items.Clear();
string enumTypeName = enumType.Name;
foreach (var enumValue in availableValues) {
- this.Items.Add(Language.Translate((Enum)enumValue));
+ Items.Add(Language.Translate((Enum)enumValue));
}
}
@@ -79,7 +79,7 @@ namespace GreenshotPlugin.Controls {
///
private void StoreSelectedEnum() {
string enumTypeName = enumType.Name;
- string selectedValue = this.SelectedItem as string;
+ string selectedValue = SelectedItem as string;
var availableValues = Enum.GetValues(enumType);
object returnValue = null;
diff --git a/GreenshotPlugin/Controls/GreenshotForm.cs b/GreenshotPlugin/Controls/GreenshotForm.cs
index 49cd89ed1..6111dabed 100644
--- a/GreenshotPlugin/Controls/GreenshotForm.cs
+++ b/GreenshotPlugin/Controls/GreenshotForm.cs
@@ -27,13 +27,14 @@ using Greenshot.IniFile;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO;
+using log4net;
namespace GreenshotPlugin.Controls {
///
/// This form is used for automatically binding the elements of the form to the language
///
public class GreenshotForm : Form, IGreenshotLanguageBindable {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(GreenshotForm));
+ private static ILog LOG = LogManager.GetLogger(typeof(GreenshotForm));
protected static CoreConfiguration coreConfiguration;
private static IDictionary reflectionCache = new Dictionary();
private IComponentChangeService m_changeService;
@@ -87,7 +88,7 @@ namespace GreenshotPlugin.Controls {
/// Code to initialize the language etc during design time
///
protected void InitializeForDesigner() {
- if (this.DesignMode) {
+ if (DesignMode) {
designTimeControls = new Dictionary();
designTimeToolStripItems = new Dictionary();
try {
@@ -97,7 +98,7 @@ namespace GreenshotPlugin.Controls {
// Language.AddLanguageFilePath(@"C:\Greenshot\Greenshot\Languages");
// this "type"
- Assembly currentAssembly = this.GetType().Assembly;
+ Assembly currentAssembly = GetType().Assembly;
string assemblyPath = typeResService.GetPathOfAssembly(currentAssembly.GetName());
string assemblyDirectory = Path.GetDirectoryName(assemblyPath);
if (!Language.AddLanguageFilePath(Path.Combine(assemblyDirectory, @"..\..\Greenshot\Languages\"))) {
@@ -117,7 +118,7 @@ namespace GreenshotPlugin.Controls {
///
///
protected override void OnPaint(PaintEventArgs e) {
- if (this.DesignMode) {
+ if (DesignMode) {
if (!isDesignModeLanguageSet) {
isDesignModeLanguageSet = true;
try {
@@ -130,7 +131,7 @@ namespace GreenshotPlugin.Controls {
}
protected override void OnLoad(EventArgs e) {
- if (!this.DesignMode) {
+ if (!DesignMode) {
if (!applyLanguageManually) {
ApplyLanguage();
}
@@ -149,7 +150,7 @@ namespace GreenshotPlugin.Controls {
///
///
protected override void OnClosed(EventArgs e) {
- if (!this.DesignMode && !storeFieldsManually) {
+ if (!DesignMode && !storeFieldsManually) {
if (DialogResult == DialogResult.OK) {
LOG.Info("Form was closed with OK: storing field values.");
StoreFields();
@@ -267,7 +268,7 @@ namespace GreenshotPlugin.Controls {
applyTo.Text = langString;
return;
}
- if (!this.DesignMode) {
+ if (!DesignMode) {
LOG.DebugFormat("Greenshot control without language key: {0}", applyTo.Name);
}
}
@@ -331,15 +332,15 @@ namespace GreenshotPlugin.Controls {
///
protected void ApplyLanguage() {
string langString = null;
- this.SuspendLayout();
+ SuspendLayout();
try {
// Set title of the form
if (!string.IsNullOrEmpty(LanguageKey) && Language.TryGetString(LanguageKey, out langString)) {
- this.Text = langString;
+ Text = langString;
}
// Reset the text values for all GreenshotControls
- foreach (FieldInfo field in GetCachedFields(this.GetType())) {
+ foreach (FieldInfo field in GetCachedFields(GetType())) {
Object controlObject = field.GetValue(this);
if (controlObject == null) {
LOG.DebugFormat("No value: {0}", field.Name);
@@ -367,7 +368,7 @@ namespace GreenshotPlugin.Controls {
}
}
} finally {
- this.ResumeLayout();
+ ResumeLayout();
}
}
@@ -388,7 +389,7 @@ namespace GreenshotPlugin.Controls {
applyTo.Text = langString;
return;
}
- if (!this.DesignMode) {
+ if (!DesignMode) {
LOG.DebugFormat("Greenshot control without language key: {0}", applyTo.Name);
}
}
@@ -398,7 +399,7 @@ namespace GreenshotPlugin.Controls {
/// Fill all GreenshotControls with the values from the configuration
///
protected void FillFields() {
- foreach (FieldInfo field in GetCachedFields(this.GetType())) {
+ foreach (FieldInfo field in GetCachedFields(GetType())) {
Object controlObject = field.GetValue(this);
if (controlObject == null) {
continue;
@@ -466,7 +467,7 @@ namespace GreenshotPlugin.Controls {
///
protected void StoreFields() {
bool iniDirty = false;
- foreach (FieldInfo field in GetCachedFields(this.GetType())) {
+ foreach (FieldInfo field in GetCachedFields(GetType())) {
Object controlObject = field.GetValue(this);
if (controlObject == null) {
continue;
diff --git a/GreenshotPlugin/Controls/HotkeyControl.cs b/GreenshotPlugin/Controls/HotkeyControl.cs
index 37095583e..d21cb5b5c 100644
--- a/GreenshotPlugin/Controls/HotkeyControl.cs
+++ b/GreenshotPlugin/Controls/HotkeyControl.cs
@@ -26,6 +26,7 @@ using System.Text;
using System.Windows.Forms;
using Greenshot.Plugin;
+using log4net;
namespace GreenshotPlugin.Controls {
///
@@ -34,7 +35,7 @@ namespace GreenshotPlugin.Controls {
/// But is modified to fit in Greenshot, and have localized support
///
public class HotkeyControl : GreenshotTextBox {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(HotkeyControl));
+ private static ILog LOG = LogManager.GetLogger(typeof(HotkeyControl));
// Holds the list of hotkeys
private static Dictionary keyHandlers = new Dictionary();
@@ -120,13 +121,13 @@ namespace GreenshotPlugin.Controls {
/// Creates a new HotkeyControl
///
public HotkeyControl() {
- this.ContextMenu = dummy; // Disable right-clicking
- this.Text = "None";
+ ContextMenu = dummy; // Disable right-clicking
+ Text = "None";
// Handle events that occurs when keys are pressed
- this.KeyPress += new KeyPressEventHandler(HotkeyControl_KeyPress);
- this.KeyUp += new KeyEventHandler(HotkeyControl_KeyUp);
- this.KeyDown += new KeyEventHandler(HotkeyControl_KeyDown);
+ KeyPress += new KeyPressEventHandler(HotkeyControl_KeyPress);
+ KeyUp += new KeyEventHandler(HotkeyControl_KeyUp);
+ KeyDown += new KeyEventHandler(HotkeyControl_KeyDown);
// Fill the ArrayLists that contain all invalid hotkey combinations
needNonShiftModifier = new ArrayList();
@@ -183,8 +184,8 @@ namespace GreenshotPlugin.Controls {
/// Resets this hotkey control to None
///
public new void Clear() {
- this.Hotkey = Keys.None;
- this.HotkeyModifiers = Keys.None;
+ Hotkey = Keys.None;
+ HotkeyModifiers = Keys.None;
}
///
@@ -197,8 +198,8 @@ namespace GreenshotPlugin.Controls {
ResetHotkey();
return;
} else {
- this._modifiers = e.Modifiers;
- this._hotkey = e.KeyCode;
+ _modifiers = e.Modifiers;
+ _hotkey = e.KeyCode;
Redraw();
}
}
@@ -210,12 +211,12 @@ namespace GreenshotPlugin.Controls {
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) {
- this._modifiers = e.Modifiers;
- this._hotkey = e.KeyCode;
+ _modifiers = e.Modifiers;
+ _hotkey = e.KeyCode;
Redraw();
}
- if (this._hotkey == Keys.None && Control.ModifierKeys == Keys.None) {
+ if (_hotkey == Keys.None && ModifierKeys == Keys.None) {
ResetHotkey();
return;
}
@@ -251,8 +252,8 @@ namespace GreenshotPlugin.Controls {
/// Clears the current hotkey and resets the TextBox
///
public void ResetHotkey() {
- this._hotkey = Keys.None;
- this._modifiers = Keys.None;
+ _hotkey = Keys.None;
+ _modifiers = Keys.None;
Redraw();
}
@@ -261,10 +262,10 @@ namespace GreenshotPlugin.Controls {
///
public Keys Hotkey {
get {
- return this._hotkey;
+ return _hotkey;
}
set {
- this._hotkey = value;
+ _hotkey = value;
Redraw(true);
}
}
@@ -273,8 +274,8 @@ namespace GreenshotPlugin.Controls {
/// Used to get/set the hotkey (e.g. Keys.A)
///
public void SetHotkey(string hotkey) {
- this._hotkey = HotkeyFromString(hotkey);
- this._modifiers = HotkeyModifiersFromString(hotkey);
+ _hotkey = HotkeyFromString(hotkey);
+ _modifiers = HotkeyModifiersFromString(hotkey);
Redraw(true);
}
@@ -283,10 +284,10 @@ namespace GreenshotPlugin.Controls {
///
public Keys HotkeyModifiers {
get {
- return this._modifiers;
+ return _modifiers;
}
set {
- this._modifiers = value;
+ _modifiers = value;
Redraw(true);
}
}
@@ -304,52 +305,52 @@ namespace GreenshotPlugin.Controls {
/// Specifies whether this function was called by the Hotkey/HotkeyModifiers properties or by the user.
private void Redraw(bool bCalledProgramatically) {
// No hotkey set
- if (this._hotkey == Keys.None) {
- this.Text = "";
+ if (_hotkey == Keys.None) {
+ Text = "";
return;
}
// LWin/RWin doesn't work as hotkeys (neither do they work as modifier keys in .NET 2.0)
- if (this._hotkey == Keys.LWin || this._hotkey == Keys.RWin) {
- this.Text = "";
+ if (_hotkey == Keys.LWin || _hotkey == Keys.RWin) {
+ Text = "";
return;
}
// Only validate input if it comes from the user
if (bCalledProgramatically == false) {
// No modifier or shift only, AND a hotkey that needs another modifier
- if ((this._modifiers == Keys.Shift || this._modifiers == Keys.None) && this.needNonShiftModifier.Contains((int)this._hotkey)) {
- if (this._modifiers == Keys.None) {
+ if ((_modifiers == Keys.Shift || _modifiers == Keys.None) && needNonShiftModifier.Contains((int)_hotkey)) {
+ if (_modifiers == Keys.None) {
// Set Ctrl+Alt as the modifier unless Ctrl+Alt+ won't work...
- if (needNonAltGrModifier.Contains((int)this._hotkey) == false) {
- this._modifiers = Keys.Alt | Keys.Control;
+ if (needNonAltGrModifier.Contains((int)_hotkey) == false) {
+ _modifiers = Keys.Alt | Keys.Control;
} else {
// ... in that case, use Shift+Alt instead.
- this._modifiers = Keys.Alt | Keys.Shift;
+ _modifiers = Keys.Alt | Keys.Shift;
}
} else {
// User pressed Shift and an invalid key (e.g. a letter or a number),
// that needs another set of modifier keys
- this._hotkey = Keys.None;
- this.Text = "";
+ _hotkey = Keys.None;
+ Text = "";
return;
}
}
// Check all Ctrl+Alt keys
- if ((this._modifiers == (Keys.Alt | Keys.Control)) && this.needNonAltGrModifier.Contains((int)this._hotkey)) {
+ if ((_modifiers == (Keys.Alt | Keys.Control)) && needNonAltGrModifier.Contains((int)_hotkey)) {
// Ctrl+Alt+4 etc won't work; reset hotkey and tell the user
- this._hotkey = Keys.None;
- this.Text = "";
+ _hotkey = Keys.None;
+ Text = "";
return;
}
}
// I have no idea why this is needed, but it is. Without this code, pressing only Ctrl
// will show up as "Control + ControlKey", etc.
- if (this._hotkey == Keys.Menu /* Alt */ || this._hotkey == Keys.ShiftKey || this._hotkey == Keys.ControlKey) {
- this._hotkey = Keys.None;
+ if (_hotkey == Keys.Menu /* Alt */ || _hotkey == Keys.ShiftKey || _hotkey == Keys.ControlKey) {
+ _hotkey = Keys.None;
}
- this.Text = HotkeyToLocalizedString(this._modifiers, this._hotkey);
+ Text = HotkeyToLocalizedString(_modifiers, _hotkey);
}
public override string ToString() {
diff --git a/GreenshotPlugin/Controls/OAuthLoginForm.cs b/GreenshotPlugin/Controls/OAuthLoginForm.cs
index 84d2d9577..5e849f185 100644
--- a/GreenshotPlugin/Controls/OAuthLoginForm.cs
+++ b/GreenshotPlugin/Controls/OAuthLoginForm.cs
@@ -27,13 +27,14 @@ using System.Windows.Forms;
using System.Web;
using System.Collections.Specialized;
using GreenshotPlugin.Core;
+using log4net;
namespace GreenshotPlugin.Controls {
///
/// The OAuthLoginForm is used to allow the user to authorize Greenshot with an "Oauth" application
///
public partial class OAuthLoginForm : Form {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OAuthLoginForm));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(OAuthLoginForm));
private string callbackUrl = null;
private IDictionary callbackParameters = null;
@@ -50,17 +51,17 @@ namespace GreenshotPlugin.Controls {
public OAuthLoginForm(string browserTitle, Size size, string authorizationLink, string callbackUrl) {
this.callbackUrl = callbackUrl;
InitializeComponent();
- this.ClientSize = size;
- this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
- this.Text = browserTitle;
- this.addressTextBox.Text = authorizationLink;
+ ClientSize = size;
+ Icon = GreenshotResources.getGreenshotIcon();
+ Text = browserTitle;
+ addressTextBox.Text = authorizationLink;
// The script errors are suppressed by using the ExtendedWebBrowser
browser.ScriptErrorsSuppressed = false;
browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
browser.Navigate(new Uri(authorizationLink));
- WindowDetails.ToForeground(this.Handle);
+ WindowDetails.ToForeground(Handle);
}
private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
@@ -69,7 +70,7 @@ namespace GreenshotPlugin.Controls {
}
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) {
LOG.DebugFormat("Navigating to url: {0}", browser.Url);
- this.addressTextBox.Text = e.Url.ToString();
+ addressTextBox.Text = e.Url.ToString();
}
private void browser_Navigated(object sender, WebBrowserNavigatedEventArgs e) {
diff --git a/GreenshotPlugin/Controls/PleaseWaitForm.cs b/GreenshotPlugin/Controls/PleaseWaitForm.cs
index 02c3a2e4c..c54177583 100644
--- a/GreenshotPlugin/Controls/PleaseWaitForm.cs
+++ b/GreenshotPlugin/Controls/PleaseWaitForm.cs
@@ -23,13 +23,14 @@ using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using GreenshotPlugin.Core;
+using log4net;
namespace GreenshotPlugin.Controls {
///
/// Description of PleaseWaitForm.
///
public partial class PleaseWaitForm : Form {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PleaseWaitForm));
+ private static ILog LOG = LogManager.GetLogger(typeof(PleaseWaitForm));
private Thread waitFor = null;
private string title;
public PleaseWaitForm() {
@@ -37,7 +38,7 @@ namespace GreenshotPlugin.Controls {
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
- this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
+ Icon = GreenshotResources.getGreenshotIcon();
}
///
@@ -61,9 +62,9 @@ namespace GreenshotPlugin.Controls {
/// delegate { with your code }
public void ShowAndWait(string title, string text, ThreadStart waitDelegate) {
this.title = title;
- this.Text = title;
- this.label_pleasewait.Text = text;
- this.cancelButton.Text = Language.GetString("CANCEL");
+ Text = title;
+ label_pleasewait.Text = text;
+ cancelButton.Text = Language.GetString("CANCEL");
// Make sure the form is shown.
Show();
diff --git a/GreenshotPlugin/Controls/QualityDialog.cs b/GreenshotPlugin/Controls/QualityDialog.cs
index 69dca92e2..869ecba73 100644
--- a/GreenshotPlugin/Controls/QualityDialog.cs
+++ b/GreenshotPlugin/Controls/QualityDialog.cs
@@ -41,20 +41,20 @@ namespace GreenshotPlugin.Controls {
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
- this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
+ Icon = GreenshotResources.getGreenshotIcon();
- this.checkBox_reduceColors.Checked = Settings.ReduceColors;
- this.trackBarJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
- this.trackBarJpegQuality.Value = Settings.JPGQuality;
- this.textBoxJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
- this.textBoxJpegQuality.Text = Settings.JPGQuality.ToString();
+ checkBox_reduceColors.Checked = Settings.ReduceColors;
+ trackBarJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
+ trackBarJpegQuality.Value = Settings.JPGQuality;
+ textBoxJpegQuality.Enabled = OutputFormat.jpg.Equals(outputSettings.Format);
+ textBoxJpegQuality.Text = Settings.JPGQuality.ToString();
WindowDetails.ToForeground(Handle);
}
- void Button_okClick(object sender, System.EventArgs e) {
- Settings.JPGQuality = this.trackBarJpegQuality.Value;
+ void Button_okClick(object sender, EventArgs e) {
+ Settings.JPGQuality = trackBarJpegQuality.Value;
Settings.ReduceColors = checkBox_reduceColors.Checked;
- if (this.checkbox_dontaskagain.Checked) {
+ if (checkbox_dontaskagain.Checked) {
conf.OutputFileJpegQuality = Settings.JPGQuality;
conf.OutputFilePromptQuality = false;
conf.OutputFileReduceColors = Settings.ReduceColors;
@@ -62,7 +62,7 @@ namespace GreenshotPlugin.Controls {
}
}
- void TrackBarJpegQualityScroll(object sender, System.EventArgs e) {
+ void TrackBarJpegQualityScroll(object sender, EventArgs e) {
textBoxJpegQuality.Text = trackBarJpegQuality.Value.ToString();
}
}
diff --git a/GreenshotPlugin/Controls/SaveImageFileDialog.cs b/GreenshotPlugin/Controls/SaveImageFileDialog.cs
index 3ca70ff18..c3acb785b 100644
--- a/GreenshotPlugin/Controls/SaveImageFileDialog.cs
+++ b/GreenshotPlugin/Controls/SaveImageFileDialog.cs
@@ -25,6 +25,7 @@ using System.Windows.Forms;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
+using log4net;
namespace GreenshotPlugin.Controls {
///
@@ -32,7 +33,7 @@ namespace GreenshotPlugin.Controls {
/// For some reason SFD is sealed :(
///
public class SaveImageFileDialog : IDisposable {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(SaveImageFileDialog));
+ private static ILog LOG = LogManager.GetLogger(typeof(SaveImageFileDialog));
private static CoreConfiguration conf = IniConfig.GetIniSection();
protected SaveFileDialog saveFileDialog;
private FilterOption[] filterOptions;
@@ -137,7 +138,7 @@ namespace GreenshotPlugin.Controls {
get {
string fn = saveFileDialog.FileName;
// if the filename contains a valid extension, which is the same like the selected filter item's extension, the filename is okay
- if(fn.EndsWith(Extension,System.StringComparison.CurrentCultureIgnoreCase)) return fn;
+ if(fn.EndsWith(Extension,StringComparison.CurrentCultureIgnoreCase)) return fn;
// otherwise we just add the selected filter item's extension
else return fn + "." + Extension;
}
@@ -156,7 +157,7 @@ namespace GreenshotPlugin.Controls {
}
set {
for(int i=0; i
/// Description of AbstractDestination.
///
public abstract class AbstractDestination : IDestination {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(AbstractDestination));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(AbstractDestination));
private static CoreConfiguration configuration = IniConfig.GetIniSection();
public virtual int CompareTo(object obj) {
@@ -246,7 +248,7 @@ namespace GreenshotPlugin.Core {
// Close
menu.Items.Add(new ToolStripSeparator());
ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString("editor_close"));
- closeItem.Image = GreenshotPlugin.Core.GreenshotResources.getImage("Close.Image");
+ closeItem.Image = GreenshotResources.getImage("Close.Image");
closeItem.Click += delegate {
// This menu entry is the close itself, we can dispose the surface
menu.Close();
@@ -285,7 +287,7 @@ namespace GreenshotPlugin.Core {
while (true) {
if (menu.Visible) {
Application.DoEvents();
- System.Threading.Thread.Sleep(100);
+ Thread.Sleep(100);
} else {
menu.Dispose();
break;
diff --git a/GreenshotPlugin/Core/AccessibleHelper.cs b/GreenshotPlugin/Core/AccessibleHelper.cs
index 999fcac4b..d47e75abe 100644
--- a/GreenshotPlugin/Core/AccessibleHelper.cs
+++ b/GreenshotPlugin/Core/AccessibleHelper.cs
@@ -23,6 +23,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using Accessibility;
+using log4net;
namespace GreenshotPlugin.Core {
@@ -32,7 +33,7 @@ namespace GreenshotPlugin.Core {
/// Maybe move the basic Accessible functions to WindowDetails!?
///
public class Accessible {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(Accessible));
+ private static ILog LOG = LogManager.GetLogger(typeof(Accessible));
#region Interop
private static int AccessibleObjectFromWindow(IntPtr hWnd, OBJID idObject, ref IAccessible acc) {
diff --git a/GreenshotPlugin/Core/AnimationHelpers.cs b/GreenshotPlugin/Core/AnimationHelpers.cs
index 8e6773cb5..eb8d49763 100644
--- a/GreenshotPlugin/Core/AnimationHelpers.cs
+++ b/GreenshotPlugin/Core/AnimationHelpers.cs
@@ -22,6 +22,7 @@ using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections.Generic;
+using log4net;
namespace GreenshotPlugin.Core {
@@ -99,9 +100,9 @@ namespace GreenshotPlugin.Core {
this.first = first;
this.last = last;
this.frames = frames;
- this.current = first;
- this.EasingType = easingType;
- this.EasingMode = easingMode;
+ current = first;
+ EasingType = easingType;
+ EasingMode = easingMode;
}
///
@@ -159,10 +160,10 @@ namespace GreenshotPlugin.Core {
///
public void ChangeDestination(T newDestination, int frames) {
queue.Clear();
- this.first = current;
- this.currentFrameNr = 0;
+ first = current;
+ currentFrameNr = 0;
this.frames = frames;
- this.last = newDestination;
+ last = newDestination;
}
///
@@ -261,13 +262,13 @@ namespace GreenshotPlugin.Core {
return true;
}
if (queue.Count > 0) {
- this.first = current;
- this.currentFrameNr = 0;
+ first = current;
+ currentFrameNr = 0;
AnimationLeg nextLeg = queue.Dequeue();
- this.last = nextLeg.Destination;
- this.frames = nextLeg.Frames;
- this.EasingType = nextLeg.EasingType;
- this.EasingMode = nextLeg.EasingMode;
+ last = nextLeg.Destination;
+ frames = nextLeg.Frames;
+ EasingType = nextLeg.EasingType;
+ EasingMode = nextLeg.EasingMode;
return true;
}
return false;
@@ -297,7 +298,7 @@ namespace GreenshotPlugin.Core {
/// Implementation of the RectangleAnimator
///
public class RectangleAnimator : AnimatorBase {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(RectangleAnimator));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(RectangleAnimator));
public RectangleAnimator(Rectangle first, Rectangle last, int frames)
: base(first, last, frames, EasingType.Linear, EasingMode.EaseIn) {
@@ -336,7 +337,7 @@ namespace GreenshotPlugin.Core {
/// Implementation of the PointAnimator
///
public class PointAnimator : AnimatorBase {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PointAnimator));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(PointAnimator));
public PointAnimator(Point first, Point last, int frames)
: base(first, last, frames, EasingType.Linear, EasingMode.EaseIn) {
}
@@ -369,7 +370,7 @@ namespace GreenshotPlugin.Core {
/// Implementation of the SizeAnimator
///
public class SizeAnimator : AnimatorBase {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(SizeAnimator));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(SizeAnimator));
public SizeAnimator(Size first, Size last, int frames)
: base(first, last, frames, EasingType.Linear, EasingMode.EaseIn) {
}
@@ -401,7 +402,7 @@ namespace GreenshotPlugin.Core {
/// Implementation of the ColorAnimator
///
public class ColorAnimator : AnimatorBase {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ColorAnimator));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(ColorAnimator));
public ColorAnimator(Color first, Color last, int frames)
: base(first, last, frames, EasingType.Linear, EasingMode.EaseIn) {
}
@@ -437,7 +438,7 @@ namespace GreenshotPlugin.Core {
/// Implementation of the IntAnimator
///
public class IntAnimator : AnimatorBase {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(IntAnimator));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(IntAnimator));
public IntAnimator(int first, int last, int frames)
: base(first, last, frames, EasingType.Linear, EasingMode.EaseIn) {
}
diff --git a/GreenshotPlugin/Core/Cache.cs b/GreenshotPlugin/Core/Cache.cs
index 01f7a1727..080e067a7 100644
--- a/GreenshotPlugin/Core/Cache.cs
+++ b/GreenshotPlugin/Core/Cache.cs
@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Timers;
+using log4net;
namespace GreenshotPlugin.Core {
///
@@ -29,7 +30,7 @@ namespace GreenshotPlugin.Core {
/// Type of key
/// Type of value
public class Cache {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(Cache));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(Cache));
private IDictionary internalCache = new Dictionary();
private object lockObject = new object();
private int secondsToExpire = 10;
diff --git a/GreenshotPlugin/Core/ClipboardHelper.cs b/GreenshotPlugin/Core/ClipboardHelper.cs
index 015b2313e..2aa361a49 100644
--- a/GreenshotPlugin/Core/ClipboardHelper.cs
+++ b/GreenshotPlugin/Core/ClipboardHelper.cs
@@ -31,13 +31,14 @@ using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.UnmanagedHelpers;
using System.Runtime.InteropServices;
+using log4net;
namespace GreenshotPlugin.Core {
///
/// Description of ClipboardHelper.
///
public static class ClipboardHelper {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ClipboardHelper));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(ClipboardHelper));
private static readonly Object clipboardLockObject = new Object();
private static readonly CoreConfiguration config = IniConfig.GetIniSection();
private static readonly string FORMAT_FILECONTENTS = "FileContents";
diff --git a/GreenshotPlugin/Core/CoreConfiguration.cs b/GreenshotPlugin/Core/CoreConfiguration.cs
index 9dc04694a..80da500dd 100644
--- a/GreenshotPlugin/Core/CoreConfiguration.cs
+++ b/GreenshotPlugin/Core/CoreConfiguration.cs
@@ -113,6 +113,8 @@ namespace GreenshotPlugin.Core {
public bool OutputFileReduceColors;
[IniProperty("OutputFileAutoReduceColors", Description = "If set to true the amount of colors is counted and if smaller than 256 the color reduction is automatically used.", DefaultValue = "false")]
public bool OutputFileAutoReduceColors;
+ [IniProperty("OutputFileReduceColorsTo", Description = "Amount of colors to reduce to, when reducing", DefaultValue = "256")]
+ public int OutputFileReduceColorsTo;
[IniProperty("OutputFileCopyPathToClipboard", Description="When saving a screenshot, copy the path to the clipboard?", DefaultValue="true")]
public bool OutputFileCopyPathToClipboard;
diff --git a/GreenshotPlugin/Core/CredentialsHelper.cs b/GreenshotPlugin/Core/CredentialsHelper.cs
index ea52b998e..2bf6e8c15 100644
--- a/GreenshotPlugin/Core/CredentialsHelper.cs
+++ b/GreenshotPlugin/Core/CredentialsHelper.cs
@@ -95,10 +95,10 @@ namespace GreenshotPlugin.Core {
/// The message of the dialog (null will cause a system default message to be used).
/// The image to display on the dialog (null will cause a system default image to be used).
public CredentialsDialog(string target, string caption, string message, Image banner) {
- this.Target = target;
- this.Caption = caption;
- this.Message = message;
- this.Banner = banner;
+ Target = target;
+ Caption = caption;
+ Message = message;
+ Banner = banner;
}
private bool _alwaysDisplay = false;
@@ -307,21 +307,21 @@ namespace GreenshotPlugin.Core {
/// Shows the credentials dialog.
/// Returns a DialogResult indicating the user action.
public DialogResult Show() {
- return Show(null, this.Name, this.Password, this.SaveChecked);
+ return Show(null, Name, Password, SaveChecked);
}
/// Shows the credentials dialog with the specified save checkbox status.
/// True if the save checkbox is checked.
/// Returns a DialogResult indicating the user action.
public DialogResult Show(bool saveChecked) {
- return Show(null, this.Name, this.Password, saveChecked);
+ return Show(null, Name, Password, saveChecked);
}
/// Shows the credentials dialog with the specified name.
/// The name for the credentials.
/// Returns a DialogResult indicating the user action.
public DialogResult Show(string name) {
- return Show(null, name, this.Password, this.SaveChecked);
+ return Show(null, name, Password, SaveChecked);
}
/// Shows the credentials dialog with the specified name and password.
@@ -329,7 +329,7 @@ namespace GreenshotPlugin.Core {
/// The password for the credentials.
/// Returns a DialogResult indicating the user action.
public DialogResult Show(string name, string password) {
- return Show(null, name, password, this.SaveChecked);
+ return Show(null, name, password, SaveChecked);
}
/// Shows the credentials dialog with the specified name, password and save checkbox status.
@@ -345,7 +345,7 @@ namespace GreenshotPlugin.Core {
/// The System.Windows.Forms.IWin32Window the dialog will display in front of.
/// Returns a DialogResult indicating the user action.
public DialogResult Show(IWin32Window owner) {
- return Show(owner, this.Name, this.Password, this.SaveChecked);
+ return Show(owner, Name, Password, SaveChecked);
}
/// Shows the credentials dialog with the specified owner and save checkbox status.
@@ -353,7 +353,7 @@ namespace GreenshotPlugin.Core {
/// True if the save checkbox is checked.
/// Returns a DialogResult indicating the user action.
public DialogResult Show(IWin32Window owner, bool saveChecked) {
- return Show(owner, this.Name, this.Password, saveChecked);
+ return Show(owner, Name, Password, saveChecked);
}
/// Shows the credentials dialog with the specified owner, name and password.
@@ -362,7 +362,7 @@ namespace GreenshotPlugin.Core {
/// The password for the credentials.
/// Returns a DialogResult indicating the user action.
public DialogResult Show(IWin32Window owner, string name, string password) {
- return Show(owner, name, password, this.SaveChecked);
+ return Show(owner, name, password, SaveChecked);
}
/// Shows the credentials dialog with the specified owner, name, password and save checkbox status.
@@ -375,9 +375,9 @@ namespace GreenshotPlugin.Core {
if ((Environment.OSVersion.Version.Major < 5) || ((Environment.OSVersion.Version.Major == 5) && (Environment.OSVersion.Version.Minor < 1))) {
throw new ApplicationException("The Credential Management API requires Windows XP / Windows Server 2003 or later.");
}
- this.Name = name;
- this.Password = password;
- this.SaveChecked = saveChecked;
+ Name = name;
+ Password = password;
+ SaveChecked = saveChecked;
return ShowDialog(owner);
}
@@ -385,7 +385,7 @@ namespace GreenshotPlugin.Core {
/// Confirmation action to be applied.
/// True if the credentials should be persisted.
public void Confirm(bool value) {
- switch (CREDUI.ConfirmCredentials(this.Target, value)) {
+ switch (CREDUI.ConfirmCredentials(Target, value)) {
case CREDUI.ReturnCodes.NO_ERROR:
break;
@@ -406,12 +406,12 @@ namespace GreenshotPlugin.Core {
private DialogResult ShowDialog(IWin32Window owner) {
// set the api call parameters
StringBuilder name = new StringBuilder(CREDUI.MAX_USERNAME_LENGTH);
- name.Append(this.Name);
+ name.Append(Name);
StringBuilder password = new StringBuilder(CREDUI.MAX_PASSWORD_LENGTH);
- password.Append(this.Password);
+ password.Append(Password);
- int saveChecked = Convert.ToInt32(this.SaveChecked);
+ int saveChecked = Convert.ToInt32(SaveChecked);
CREDUI.INFO info = GetInfo(owner);
CREDUI.FLAGS flags = GetFlags();
@@ -419,7 +419,7 @@ namespace GreenshotPlugin.Core {
// make the api call
CREDUI.ReturnCodes code = CREDUI.PromptForCredentials(
ref info,
- this.Target,
+ Target,
IntPtr.Zero, 0,
name, CREDUI.MAX_USERNAME_LENGTH,
password, CREDUI.MAX_PASSWORD_LENGTH,
@@ -428,14 +428,14 @@ namespace GreenshotPlugin.Core {
);
// clean up resources
- if (this.Banner != null) {
+ if (Banner != null) {
DeleteObject(info.hbmBanner);
}
// set the accessors from the api call parameters
- this.Name = name.ToString();
- this.Password = password.ToString();
- this.SaveChecked = Convert.ToBoolean(saveChecked);
+ Name = name.ToString();
+ Password = password.ToString();
+ SaveChecked = Convert.ToBoolean(saveChecked);
return GetDialogResult(code);
}
@@ -445,10 +445,10 @@ namespace GreenshotPlugin.Core {
private CREDUI.INFO GetInfo(IWin32Window owner) {
CREDUI.INFO info = new CREDUI.INFO();
if (owner != null) info.hwndParent = owner.Handle;
- info.pszCaptionText = this.Caption;
- info.pszMessageText = this.Message;
- if (this.Banner != null) {
- info.hbmBanner = new Bitmap(this.Banner, ValidBannerWidth, ValidBannerHeight).GetHbitmap();
+ info.pszCaptionText = Caption;
+ info.pszMessageText = Message;
+ if (Banner != null) {
+ info.hbmBanner = new Bitmap(Banner, ValidBannerWidth, ValidBannerHeight).GetHbitmap();
}
info.cbSize = Marshal.SizeOf(info);
return info;
@@ -458,21 +458,21 @@ namespace GreenshotPlugin.Core {
private CREDUI.FLAGS GetFlags() {
CREDUI.FLAGS flags = CREDUI.FLAGS.GENERIC_CREDENTIALS;
- if (this.IncorrectPassword) {
+ if (IncorrectPassword) {
flags = flags | CREDUI.FLAGS.INCORRECT_PASSWORD;
}
- if (this.AlwaysDisplay) {
+ if (AlwaysDisplay) {
flags = flags | CREDUI.FLAGS.ALWAYS_SHOW_UI;
}
- if (this.ExcludeCertificates) {
+ if (ExcludeCertificates) {
flags = flags | CREDUI.FLAGS.EXCLUDE_CERTIFICATES;
}
- if (this.Persist) {
+ if (Persist) {
flags = flags | CREDUI.FLAGS.EXPECT_CONFIRMATION;
- if (this.SaveDisplayed) {
+ if (SaveDisplayed) {
flags = flags | CREDUI.FLAGS.SHOW_SAVE_CHECK_BOX;
} else {
flags = flags | CREDUI.FLAGS.PERSIST;
@@ -481,7 +481,7 @@ namespace GreenshotPlugin.Core {
flags = flags | CREDUI.FLAGS.DO_NOT_PERSIST;
}
- if (this.KeepName) {
+ if (KeepName) {
flags = flags | CREDUI.FLAGS.KEEP_USERNAME;
}
diff --git a/GreenshotPlugin/Core/DisplayKeyAttribute.cs b/GreenshotPlugin/Core/DisplayKeyAttribute.cs
index 44235d809..c64422e1e 100644
--- a/GreenshotPlugin/Core/DisplayKeyAttribute.cs
+++ b/GreenshotPlugin/Core/DisplayKeyAttribute.cs
@@ -29,7 +29,7 @@ namespace GreenshotPlugin.Core {
}
public DisplayKeyAttribute(string v) {
- this.value = v;
+ value = v;
}
public DisplayKeyAttribute() {
diff --git a/GreenshotPlugin/Core/Effects.cs b/GreenshotPlugin/Core/Effects.cs
index a3b26140b..ae291c87e 100644
--- a/GreenshotPlugin/Core/Effects.cs
+++ b/GreenshotPlugin/Core/Effects.cs
@@ -27,6 +27,7 @@ using Greenshot.Plugin.Drawing;
using System.IO;
using System.Collections.Generic;
using GreenshotPlugin.Core;
+using log4net;
namespace Greenshot.Core {
///
@@ -147,7 +148,7 @@ namespace Greenshot.Core {
/// ReduceColorsEffect
///
public class ReduceColorsEffect : IEffect {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ReduceColorsEffect));
+ private static ILog LOG = LogManager.GetLogger(typeof(ReduceColorsEffect));
public ReduceColorsEffect() : base() {
Colors = 256;
}
diff --git a/GreenshotPlugin/Core/EncryptionHelper.cs b/GreenshotPlugin/Core/EncryptionHelper.cs
index 025a983e0..91dbfeca8 100644
--- a/GreenshotPlugin/Core/EncryptionHelper.cs
+++ b/GreenshotPlugin/Core/EncryptionHelper.cs
@@ -22,10 +22,11 @@ using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
+using log4net;
namespace GreenshotPlugin.Core {
public static class EncryptionHelper {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(EncryptionHelper));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(EncryptionHelper));
private const string RGBIV = "dlgjowejgogkklwj";
private const string KEY = "lsjvkwhvwujkagfauguwcsjgu2wueuff";
diff --git a/GreenshotPlugin/Core/EnumExtensions.cs b/GreenshotPlugin/Core/EnumExtensions.cs
index e56964e7a..a23263ee4 100644
--- a/GreenshotPlugin/Core/EnumExtensions.cs
+++ b/GreenshotPlugin/Core/EnumExtensions.cs
@@ -21,7 +21,7 @@
using System;
namespace GreenshotPlugin.Core {
public static class EnumerationExtensions {
- public static bool Has(this System.Enum type, T value) {
+ public static bool Has(this Enum type, T value) {
Type underlyingType = Enum.GetUnderlyingType(value.GetType());
try {
if (underlyingType == typeof(int)) {
@@ -34,7 +34,7 @@ namespace GreenshotPlugin.Core {
return false;
}
- public static bool Is(this System.Enum type, T value) {
+ public static bool Is(this Enum type, T value) {
Type underlyingType = Enum.GetUnderlyingType(value.GetType());
try {
if (underlyingType == typeof(int)) {
@@ -53,7 +53,7 @@ namespace GreenshotPlugin.Core {
///
///
///
- public static T Add(this System.Enum type, T value) {
+ public static T Add(this Enum type, T value) {
Type underlyingType = Enum.GetUnderlyingType(value.GetType());
try {
if (underlyingType == typeof(int)) {
@@ -73,7 +73,7 @@ namespace GreenshotPlugin.Core {
///
///
///
- public static T Remove(this System.Enum type, T value) {
+ public static T Remove(this Enum type, T value) {
Type underlyingType = Enum.GetUnderlyingType(value.GetType());
try {
if (underlyingType == typeof(int)) {
diff --git a/GreenshotPlugin/Core/FastBitmap.cs b/GreenshotPlugin/Core/FastBitmap.cs
index d7268e1db..aa625e630 100644
--- a/GreenshotPlugin/Core/FastBitmap.cs
+++ b/GreenshotPlugin/Core/FastBitmap.cs
@@ -22,6 +22,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
+using log4net;
namespace GreenshotPlugin.Core {
@@ -283,7 +284,7 @@ namespace GreenshotPlugin.Core {
/// The base class for the fast bitmap implementation
///
public unsafe abstract class FastBitmap : IFastBitmap, IFastBitmapWithClip, IFastBitmapWithOffset {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FastBitmap));
+ private static ILog LOG = LogManager.GetLogger(typeof(FastBitmap));
protected const int PIXELFORMAT_INDEX_A = 3;
protected const int PIXELFORMAT_INDEX_R = 2;
@@ -427,11 +428,11 @@ namespace GreenshotPlugin.Core {
this.area = bitmapArea;
}
// As the lock takes care that only the specified area is made available we need to calculate the offset
- this.Left = area.Left;
- this.Top = area.Top;
+ Left = area.Left;
+ Top = area.Top;
// Default cliping is done to the area without invert
- this.Clip = this.area;
- this.InvertClip = false;
+ Clip = this.area;
+ InvertClip = false;
// Always lock, so we don't need to do this ourselves
Lock();
}
@@ -639,7 +640,7 @@ namespace GreenshotPlugin.Core {
Unlock();
}
- graphics.DrawImage(this.bitmap, destinationRect, area, GraphicsUnit.Pixel);
+ graphics.DrawImage(bitmap, destinationRect, area, GraphicsUnit.Pixel);
}
///
diff --git a/GreenshotPlugin/Core/FilenameHelper.cs b/GreenshotPlugin/Core/FilenameHelper.cs
index b03a3909e..cbc0f27dc 100644
--- a/GreenshotPlugin/Core/FilenameHelper.cs
+++ b/GreenshotPlugin/Core/FilenameHelper.cs
@@ -25,10 +25,11 @@ using System.Text.RegularExpressions;
using System.Windows.Forms;
using Greenshot.IniFile;
using Greenshot.Plugin;
+using log4net;
namespace GreenshotPlugin.Core {
public static class FilenameHelper {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FilenameHelper));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(FilenameHelper));
private static readonly Regex VAR_REGEXP = new Regex(@"\${(?[^:}]+)[:]?(?[^}]*)}", RegexOptions.Compiled);
private static readonly Regex SPLIT_REGEXP = new Regex(";(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", RegexOptions.Compiled);
private const int MAX_TITLE_LENGTH = 80;
@@ -104,7 +105,7 @@ namespace GreenshotPlugin.Core {
if (pattern == null || string.IsNullOrEmpty(pattern.Trim())) {
pattern = "greenshot ${capturetime}";
}
- return FilenameHelper.GetFilenameFromPattern(pattern, format, captureDetails);
+ return GetFilenameFromPattern(pattern, format, captureDetails);
}
diff --git a/GreenshotPlugin/Core/IEHelper.cs b/GreenshotPlugin/Core/IEHelper.cs
index 943a46530..69a753ee5 100644
--- a/GreenshotPlugin/Core/IEHelper.cs
+++ b/GreenshotPlugin/Core/IEHelper.cs
@@ -57,7 +57,7 @@ namespace GreenshotPlugin.Core {
}
WindowDetails tmpWD = browserWindowDetails;
// Since IE 9 the TabBandClass is less deep!
- if (IEHelper.IEVersion() < 9) {
+ if (IEVersion() < 9) {
tmpWD = tmpWD.GetChild("CommandBarClass");
if (tmpWD != null) {
tmpWD = tmpWD.GetChild("ReBarWindow32");
diff --git a/GreenshotPlugin/Core/ImageHelper.cs b/GreenshotPlugin/Core/ImageHelper.cs
index 37c9089bc..e558fccac 100644
--- a/GreenshotPlugin/Core/ImageHelper.cs
+++ b/GreenshotPlugin/Core/ImageHelper.cs
@@ -29,6 +29,7 @@ using Greenshot.IniFile;
using GreenshotPlugin.UnmanagedHelpers;
using Greenshot.Plugin;
using Greenshot.Core;
+using log4net;
namespace GreenshotPlugin.Core {
internal enum ExifOrientations : byte {
@@ -47,7 +48,7 @@ namespace GreenshotPlugin.Core {
/// Description of ImageHelper.
///
public static class ImageHelper {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImageHelper));
+ private static ILog LOG = LogManager.GetLogger(typeof(ImageHelper));
private static CoreConfiguration conf = IniConfig.GetIniSection();
private const int EXIF_ORIENTATION_ID = 0x0112;
@@ -143,7 +144,7 @@ namespace GreenshotPlugin.Core {
}
Bitmap bmp = new Bitmap(thumbWidth, thumbHeight);
- using (Graphics graphics = System.Drawing.Graphics.FromImage(bmp)) {
+ using (Graphics graphics = Graphics.FromImage(bmp)) {
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
@@ -310,7 +311,7 @@ namespace GreenshotPlugin.Core {
LOG.InfoFormat("Information about file {0}: {1}x{2}-{3} Resolution {4}x{5}", filename, fileImage.Width, fileImage.Height, fileImage.PixelFormat, fileImage.HorizontalResolution, fileImage.VerticalResolution);
}
// Make sure the orientation is set correctly so Greenshot can process the image correctly
- ImageHelper.Orientate(fileImage);
+ Orientate(fileImage);
return fileImage;
}
@@ -338,7 +339,7 @@ namespace GreenshotPlugin.Core {
int iImageOffset = BitConverter.ToInt32(srcBuf, SizeICONDIR + SizeICONDIRENTRY * iIndex + 12);
using (MemoryStream destStream = new MemoryStream()) {
destStream.Write(srcBuf, iImageOffset, iImageSize);
- destStream.Seek(0, System.IO.SeekOrigin.Begin);
+ destStream.Seek(0, SeekOrigin.Begin);
bmpPngExtracted = new Bitmap(destStream); // This is PNG! :)
}
break;
@@ -857,7 +858,7 @@ namespace GreenshotPlugin.Core {
/// Bitmap to create a negative off
/// Negative bitmap
public static Bitmap CreateNegative(Image sourceImage) {
- Bitmap clone = (Bitmap)ImageHelper.Clone(sourceImage);
+ Bitmap clone = (Bitmap)Clone(sourceImage);
ColorMatrix invertMatrix = new ColorMatrix(new float[][] {
new float[] {-1, 0, 0, 0, 0},
new float[] {0, -1, 0, 0, 0},
@@ -1036,7 +1037,7 @@ namespace GreenshotPlugin.Core {
/// Original bitmap
/// Bitmap with grayscale
public static Image CreateGrayscale(Image sourceImage) {
- Bitmap clone = (Bitmap)ImageHelper.Clone(sourceImage);
+ Bitmap clone = (Bitmap)Clone(sourceImage);
ColorMatrix grayscaleMatrix = new ColorMatrix( new float[][] {
new float[] {.3f, .3f, .3f, 0, 0},
new float[] {.59f, .59f, .59f, 0, 0},
@@ -1334,22 +1335,22 @@ namespace GreenshotPlugin.Core {
if (nPercentW == 1) {
nPercentW = nPercentH;
if (canvasUseNewSize) {
- destX = Math.Max(0, System.Convert.ToInt32((newWidth - (sourceImage.Width * nPercentW)) / 2));
+ destX = Math.Max(0, Convert.ToInt32((newWidth - (sourceImage.Width * nPercentW)) / 2));
}
} else if (nPercentH == 1) {
nPercentH = nPercentW;
if (canvasUseNewSize) {
- destY = Math.Max(0, System.Convert.ToInt32((newHeight - (sourceImage.Height * nPercentH)) / 2));
+ destY = Math.Max(0, Convert.ToInt32((newHeight - (sourceImage.Height * nPercentH)) / 2));
}
} else if (nPercentH != 0 && nPercentH < nPercentW) {
nPercentW = nPercentH;
if (canvasUseNewSize) {
- destX = Math.Max(0, System.Convert.ToInt32((newWidth - (sourceImage.Width * nPercentW)) / 2));
+ destX = Math.Max(0, Convert.ToInt32((newWidth - (sourceImage.Width * nPercentW)) / 2));
}
} else {
nPercentH = nPercentW;
if (canvasUseNewSize) {
- destY = Math.Max(0, System.Convert.ToInt32((newHeight - (sourceImage.Height * nPercentH)) / 2));
+ destY = Math.Max(0, Convert.ToInt32((newHeight - (sourceImage.Height * nPercentH)) / 2));
}
}
}
diff --git a/GreenshotPlugin/Core/ImageOutput.cs b/GreenshotPlugin/Core/ImageOutput.cs
index b9cbbe8fa..6fbdd5d3d 100644
--- a/GreenshotPlugin/Core/ImageOutput.cs
+++ b/GreenshotPlugin/Core/ImageOutput.cs
@@ -18,29 +18,32 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+
+using Greenshot.IniFile;
+using Greenshot.Plugin;
+using GreenshotPlugin.Controls;
+using log4net;
using System;
+using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
-using Greenshot.IniFile;
-using Greenshot.Plugin;
-using GreenshotPlugin.Controls;
-using Greenshot.Core;
-using System.Diagnostics;
-using System.Security.AccessControl;
+using Encoder = System.Drawing.Imaging.Encoder;
namespace GreenshotPlugin.Core {
///
/// Description of ImageOutput.
///
public static class ImageOutput {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImageOutput));
- private static CoreConfiguration conf = IniConfig.GetIniSection();
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(ImageOutput));
+ private static readonly CoreConfiguration conf = IniConfig.GetIniSection();
private static readonly int PROPERTY_TAG_SOFTWARE_USED = 0x0131;
- private static Cache tmpFileCache = new Cache(10 * 60 * 60, new Cache.CacheObjectExpired(RemoveExpiredTmpFile));
+ private static Cache tmpFileCache = new Cache(10 * 60 * 60, RemoveExpiredTmpFile);
///
/// Creates a PropertyItem (Metadata) to store with the image.
@@ -60,7 +63,7 @@ namespace GreenshotPlugin.Core {
// Set the ID
propertyItem.Id = id;
// Set the text
- byte[] byteString = System.Text.ASCIIEncoding.ASCII.GetBytes(text + " ");
+ byte[] byteString = Encoding.ASCII.GetBytes(text + " ");
// Set Zero byte for String end.
byteString[byteString.Length - 1] = 0;
propertyItem.Value = byteString;
@@ -78,7 +81,7 @@ namespace GreenshotPlugin.Core {
/// Stream to save to
/// SurfaceOutputSettings
public static void SaveToStream(ISurface surface, Stream stream, SurfaceOutputSettings outputSettings) {
- Image imageToSave = null;
+ Image imageToSave;
bool disposeImage = CreateImageFromSurface(surface, outputSettings, out imageToSave);
SaveToStream(imageToSave, surface, stream, outputSettings);
// cleanup if needed
@@ -97,7 +100,7 @@ namespace GreenshotPlugin.Core {
/// Stream to save to
/// SurfaceOutputSettings
public static void SaveToStream(Image imageToSave, ISurface surface, Stream stream, SurfaceOutputSettings outputSettings) {
- ImageFormat imageFormat = null;
+ ImageFormat imageFormat;
bool useMemoryStream = false;
MemoryStream memoryStream = null;
if (outputSettings.Format == OutputFormat.greenshot && surface == null) {
@@ -118,8 +121,6 @@ namespace GreenshotPlugin.Core {
case OutputFormat.tiff:
imageFormat = ImageFormat.Tiff;
break;
- case OutputFormat.greenshot:
- case OutputFormat.png:
default:
// Problem with non-seekable streams most likely doesn't happen with Windows 7 (OS Version 6.1 and later)
// http://stackoverflow.com/questions/8349260/generic-gdi-error-on-one-machine-but-not-the-other
@@ -144,7 +145,7 @@ namespace GreenshotPlugin.Core {
targetStream = memoryStream;
}
- if (imageFormat == ImageFormat.Jpeg) {
+ if (Equals(imageFormat, ImageFormat.Jpeg)) {
bool foundEncoder = false;
foreach (ImageCodecInfo imageCodec in ImageCodecInfo.GetImageEncoders()) {
if (imageCodec.FormatID == imageFormat.Guid) {
@@ -171,14 +172,14 @@ namespace GreenshotPlugin.Core {
} else {
bool needsDispose = false;
// Removing transparency if it's not supported in the output
- if (imageFormat != ImageFormat.Png && Image.IsAlphaPixelFormat(imageToSave.PixelFormat)) {
+ if (!Equals(imageFormat, ImageFormat.Png) && Image.IsAlphaPixelFormat(imageToSave.PixelFormat)) {
imageToSave = ImageHelper.Clone(imageToSave, PixelFormat.Format24bppRgb);
needsDispose = true;
}
AddTag(imageToSave);
// Added for OptiPNG
bool processed = false;
- if (imageFormat == ImageFormat.Png && !string.IsNullOrEmpty(conf.OptimizePNGCommand)) {
+ if (Equals(imageFormat, ImageFormat.Png) && !string.IsNullOrEmpty(conf.OptimizePNGCommand)) {
processed = ProcessPNGImageExternally(imageToSave, targetStream);
}
if (!processed) {
@@ -202,7 +203,7 @@ namespace GreenshotPlugin.Core {
using (BinaryWriter writer = new BinaryWriter(tmpStream)) {
writer.Write(bytesWritten);
Version v = Assembly.GetExecutingAssembly().GetName().Version;
- byte[] marker = System.Text.Encoding.ASCII.GetBytes(String.Format("Greenshot{0:00}.{1:00}", v.Major, v.Minor));
+ byte[] marker = Encoding.ASCII.GetBytes(String.Format("Greenshot{0:00}.{1:00}", v.Major, v.Minor));
writer.Write(marker);
tmpStream.WriteTo(stream);
}
@@ -249,19 +250,21 @@ namespace GreenshotPlugin.Core {
processStartInfo.RedirectStandardError = true;
processStartInfo.UseShellExecute = false;
Process process = Process.Start(processStartInfo);
- process.WaitForExit();
- if (process.ExitCode == 0) {
- if (LOG.IsDebugEnabled) {
- LOG.DebugFormat("File size after processing {0}", new FileInfo(tmpFileName).Length);
- LOG.DebugFormat("Reading back tmp file: {0}", tmpFileName);
+ if (process != null) {
+ process.WaitForExit();
+ if (process.ExitCode == 0) {
+ if (LOG.IsDebugEnabled) {
+ LOG.DebugFormat("File size after processing {0}", new FileInfo(tmpFileName).Length);
+ LOG.DebugFormat("Reading back tmp file: {0}", tmpFileName);
+ }
+ byte[] processedImage = File.ReadAllBytes(tmpFileName);
+ targetStream.Write(processedImage, 0, processedImage.Length);
+ return true;
}
- byte[] processedImage = File.ReadAllBytes(tmpFileName);
- targetStream.Write(processedImage, 0, processedImage.Length);
- return true;
+ LOG.ErrorFormat("Error while processing PNG image: {0}", process.ExitCode);
+ LOG.ErrorFormat("Output: {0}", process.StandardOutput.ReadToEnd());
+ LOG.ErrorFormat("Error: {0}", process.StandardError.ReadToEnd());
}
- LOG.ErrorFormat("Error while processing PNG image: {0}", process.ExitCode);
- LOG.ErrorFormat("Output: {0}", process.StandardOutput.ReadToEnd());
- LOG.ErrorFormat("Error: {0}", process.StandardError.ReadToEnd());
} catch (Exception e) {
LOG.Error("Error while processing PNG image: ", e);
} finally {
@@ -282,26 +285,6 @@ namespace GreenshotPlugin.Core {
/// true if the image must be disposed
public static bool CreateImageFromSurface(ISurface surface, SurfaceOutputSettings outputSettings, out Image imageToSave) {
bool disposeImage = false;
- ImageFormat imageFormat = null;
- switch (outputSettings.Format) {
- case OutputFormat.bmp:
- imageFormat = ImageFormat.Bmp;
- break;
- case OutputFormat.gif:
- imageFormat = ImageFormat.Gif;
- break;
- case OutputFormat.jpg:
- imageFormat = ImageFormat.Jpeg;
- break;
- case OutputFormat.tiff:
- imageFormat = ImageFormat.Tiff;
- break;
- case OutputFormat.greenshot:
- case OutputFormat.png:
- default:
- imageFormat = ImageFormat.Png;
- break;
- }
if (outputSettings.Format == OutputFormat.greenshot || outputSettings.SaveBackgroundOnly) {
// We save the image of the surface, this should not be disposed
@@ -313,47 +296,50 @@ namespace GreenshotPlugin.Core {
}
// The following block of modifications should be skipped when saving the greenshot format, no effects or otherwise!
- if (outputSettings.Format != OutputFormat.greenshot) {
- Image tmpImage;
- if (outputSettings.Effects != null && outputSettings.Effects.Count > 0) {
- // apply effects, if there are any
- Point ignoreOffset;
- tmpImage = ImageHelper.ApplyEffects((Bitmap)imageToSave, outputSettings.Effects, out ignoreOffset);
- if (tmpImage != null) {
+ if (outputSettings.Format == OutputFormat.greenshot) {
+ return disposeImage;
+ }
+ Image tmpImage;
+ if (outputSettings.Effects != null && outputSettings.Effects.Count > 0) {
+ // apply effects, if there are any
+ Point ignoreOffset;
+ tmpImage = ImageHelper.ApplyEffects(imageToSave, outputSettings.Effects, out ignoreOffset);
+ if (tmpImage != null) {
+ if (disposeImage) {
+ imageToSave.Dispose();
+ }
+ imageToSave = tmpImage;
+ disposeImage = true;
+ }
+ }
+
+ // check for color reduction, forced or automatically, only when the DisableReduceColors is false
+ if (outputSettings.DisableReduceColors || (!conf.OutputFileAutoReduceColors && !outputSettings.ReduceColors)) {
+ return disposeImage;
+ }
+ bool isAlpha = Image.IsAlphaPixelFormat(imageToSave.PixelFormat);
+ if (outputSettings.ReduceColors || (!isAlpha && conf.OutputFileAutoReduceColors)) {
+ using (var quantizer = new WuQuantizer((Bitmap)imageToSave)) {
+ int colorCount = quantizer.GetColorCount();
+ LOG.InfoFormat("Image with format {0} has {1} colors", imageToSave.PixelFormat, colorCount);
+ if (!outputSettings.ReduceColors && colorCount >= 256) {
+ return disposeImage;
+ }
+ try {
+ LOG.Info("Reducing colors on bitmap to 256.");
+ tmpImage = quantizer.GetQuantizedImage(conf.OutputFileReduceColorsTo);
if (disposeImage) {
imageToSave.Dispose();
}
imageToSave = tmpImage;
+ // Make sure the "new" image is disposed
disposeImage = true;
+ } catch (Exception e) {
+ LOG.Warn("Error occurred while Quantizing the image, ignoring and using original. Error: ", e);
}
}
-
- // check for color reduction, forced or automatically, only when the DisableReduceColors is false
- if (!outputSettings.DisableReduceColors && (conf.OutputFileAutoReduceColors || outputSettings.ReduceColors)) {
- bool isAlpha = Image.IsAlphaPixelFormat(imageToSave.PixelFormat);
- if (outputSettings.ReduceColors || (!isAlpha && conf.OutputFileAutoReduceColors)) {
- using (WuQuantizer quantizer = new WuQuantizer((Bitmap)imageToSave)) {
- int colorCount = quantizer.GetColorCount();
- LOG.InfoFormat("Image with format {0} has {1} colors", imageToSave.PixelFormat, colorCount);
- if (outputSettings.ReduceColors || colorCount < 256) {
- try {
- LOG.Info("Reducing colors on bitmap to 256.");
- tmpImage = quantizer.GetQuantizedImage(256);
- if (disposeImage) {
- imageToSave.Dispose();
- }
- imageToSave = tmpImage;
- // Make sure the "new" image is disposed
- disposeImage = true;
- } catch (Exception e) {
- LOG.Warn("Error occurred while Quantizing the image, ignoring and using original. Error: ", e);
- }
- }
- }
- } else if (isAlpha && !outputSettings.ReduceColors) {
- LOG.Info("Skipping 'optional' color reduction as the image has alpha");
- }
- }
+ } else if (isAlpha && !outputSettings.ReduceColors) {
+ LOG.Info("Skipping 'optional' color reduction as the image has alpha");
}
return disposeImage;
}
@@ -378,12 +364,13 @@ namespace GreenshotPlugin.Core {
/// Load a Greenshot surface
///
///
+ ///
///
public static ISurface LoadGreenshotSurface(string fullPath, ISurface returnSurface) {
if (string.IsNullOrEmpty(fullPath)) {
return null;
}
- Image fileImage = null;
+ Image fileImage;
LOG.InfoFormat("Loading image from file {0}", fullPath);
// Fixed lock problem Bug #3431881
using (Stream surfaceFileStream = File.OpenRead(fullPath)) {
@@ -402,15 +389,14 @@ namespace GreenshotPlugin.Core {
string greenshotMarker;
using (StreamReader streamReader = new StreamReader(surfaceFileStream)) {
greenshotMarker = streamReader.ReadToEnd();
- if (greenshotMarker == null || !greenshotMarker.StartsWith("Greenshot")) {
+ if (!greenshotMarker.StartsWith("Greenshot")) {
throw new ArgumentException(string.Format("{0} is not a Greenshot file!", fullPath));
}
LOG.InfoFormat("Greenshot file format: {0}", greenshotMarker);
const int filesizeLocation = 8 + markerSize;
surfaceFileStream.Seek(-filesizeLocation, SeekOrigin.End);
- long bytesWritten = 0;
using (BinaryReader reader = new BinaryReader(surfaceFileStream)) {
- bytesWritten = reader.ReadInt64();
+ long bytesWritten = reader.ReadInt64();
surfaceFileStream.Seek(-(bytesWritten + filesizeLocation), SeekOrigin.End);
returnSurface.LoadElementsFromStream(surfaceFileStream);
}
@@ -431,9 +417,11 @@ namespace GreenshotPlugin.Core {
string path = Path.GetDirectoryName(fullPath);
// check whether path exists - if not create it
- DirectoryInfo di = new DirectoryInfo(path);
- if (!di.Exists) {
- Directory.CreateDirectory(di.FullName);
+ if (path != null) {
+ DirectoryInfo di = new DirectoryInfo(path);
+ if (!di.Exists) {
+ Directory.CreateDirectory(di.FullName);
+ }
}
if (!allowOverwrite && File.Exists(fullPath)) {
@@ -462,9 +450,7 @@ namespace GreenshotPlugin.Core {
string extension = fullPath.Substring(fullPath.LastIndexOf(".") + 1);
OutputFormat format = OutputFormat.png;
try {
- if (extension != null) {
- format = (OutputFormat)Enum.Parse(typeof(OutputFormat), extension.ToLower());
- }
+ format = (OutputFormat)Enum.Parse(typeof(OutputFormat), extension.ToLower());
} catch (ArgumentException ae) {
LOG.Warn("Couldn't parse extension: " + extension, ae);
}
@@ -493,10 +479,10 @@ namespace GreenshotPlugin.Core {
qualityDialog.ShowDialog();
}
// TODO: For now we always overwrite, should be changed
- ImageOutput.Save(surface, fileNameWithExtension, true, outputSettings, conf.OutputFileCopyPathToClipboard);
+ Save(surface, fileNameWithExtension, true, outputSettings, conf.OutputFileCopyPathToClipboard);
returnValue = fileNameWithExtension;
IniConfig.Save();
- } catch (System.Runtime.InteropServices.ExternalException) {
+ } catch (ExternalException) {
MessageBox.Show(Language.GetFormattedString("error_nowriteaccess", saveImageFileDialog.FileName).Replace(@"\\", @"\"), Language.GetString("error"));
}
}
@@ -530,13 +516,13 @@ namespace GreenshotPlugin.Core {
// Catching any exception to prevent that the user can't write in the directory.
// This is done for e.g. bugs #2974608, #2963943, #2816163, #2795317, #2789218
try {
- ImageOutput.Save(surface, tmpFile, true, outputSettings, false);
+ Save(surface, tmpFile, true, outputSettings, false);
tmpFileCache.Add(tmpFile, tmpFile);
} catch (Exception e) {
// Show the problem
MessageBox.Show(e.Message, "Error");
// when save failed we present a SaveWithDialog
- tmpFile = ImageOutput.SaveWithDialog(surface, captureDetails);
+ tmpFile = SaveWithDialog(surface, captureDetails);
}
return tmpFile;
}
@@ -555,7 +541,8 @@ namespace GreenshotPlugin.Core {
tmpFileCache.Remove(tmpfile);
}
return true;
- } catch (Exception) {
+ } catch (Exception ex) {
+ LOG.Warn("Error deleting tmp file: ", ex);
}
return false;
}
@@ -563,7 +550,9 @@ namespace GreenshotPlugin.Core {
///
/// Helper method to create a temp image file
///
- ///
+ ///
+ ///
+ ///
///
public static string SaveToTmpFile(ISurface surface, SurfaceOutputSettings outputSettings, string destinationPath) {
string tmpFile = Path.GetRandomFileName() + "." + outputSettings.Format.ToString();
@@ -576,7 +565,7 @@ namespace GreenshotPlugin.Core {
LOG.Debug("Creating TMP File : " + tmpPath);
try {
- ImageOutput.Save(surface, tmpPath, true, outputSettings, false);
+ Save(surface, tmpPath, true, outputSettings, false);
tmpFileCache.Add(tmpPath, tmpPath);
} catch (Exception) {
return null;
@@ -600,8 +589,8 @@ namespace GreenshotPlugin.Core {
///
/// Cleanup handler for expired tempfiles
///
+ ///
///
- ///
private static void RemoveExpiredTmpFile(string filekey, object filename) {
string path = filename as string;
if (path != null && File.Exists(path)) {
diff --git a/GreenshotPlugin/Core/InterfaceUtils.cs b/GreenshotPlugin/Core/InterfaceUtils.cs
index dba33234f..f3ef35cbb 100644
--- a/GreenshotPlugin/Core/InterfaceUtils.cs
+++ b/GreenshotPlugin/Core/InterfaceUtils.cs
@@ -23,13 +23,14 @@ using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using Greenshot.Plugin;
+using log4net;
namespace GreenshotPlugin.Core {
///
/// Description of InterfaceUtils.
///
public static class InterfaceUtils {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(InterfaceUtils));
+ private static ILog LOG = LogManager.GetLogger(typeof(InterfaceUtils));
public static List GetSubclassesOf(Type type, bool excludeSystemTypes) {
List list = new List();
diff --git a/GreenshotPlugin/Core/Language.cs b/GreenshotPlugin/Core/Language.cs
index ec3cd4068..8e7773699 100644
--- a/GreenshotPlugin/Core/Language.cs
+++ b/GreenshotPlugin/Core/Language.cs
@@ -25,6 +25,7 @@ using System.Reflection;
using System.Text.RegularExpressions;
using System.Xml;
using Greenshot.IniFile;
+using log4net;
using Microsoft.Win32;
namespace GreenshotPlugin.Core {
@@ -34,7 +35,7 @@ namespace GreenshotPlugin.Core {
/// The language resources are loaded from the language files found on fixed or supplied paths
///
public class Language {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(Language));
+ private static ILog LOG = LogManager.GetLogger(typeof(Language));
private static List languagePaths = new List();
private static IDictionary> languageFiles = new Dictionary>();
private static IDictionary helpFiles = new Dictionary();
@@ -534,8 +535,8 @@ namespace GreenshotPlugin.Core {
public static string Translate(object key) {
string typename = key.GetType().Name;
string enumKey = typename + "." + key.ToString();
- if (Language.hasKey(enumKey)) {
- return Language.GetString(enumKey);
+ if (hasKey(enumKey)) {
+ return GetString(enumKey);
}
return key.ToString();
}
diff --git a/GreenshotPlugin/Core/LogHelper.cs b/GreenshotPlugin/Core/LogHelper.cs
index 1cea2daaf..59ab4f6b1 100644
--- a/GreenshotPlugin/Core/LogHelper.cs
+++ b/GreenshotPlugin/Core/LogHelper.cs
@@ -28,6 +28,7 @@ using log4net.Appender;
using log4net.Config;
using log4net.Repository.Hierarchy;
using System;
+using log4net.Util;
namespace GreenshotPlugin.Core {
///
@@ -98,8 +99,8 @@ namespace GreenshotPlugin.Core {
///
/// A simple helper class to support the logging to the AppData location
///
- public class SpecialFolderPatternConverter : log4net.Util.PatternConverter {
- override protected void Convert(System.IO.TextWriter writer, object state) {
+ public class SpecialFolderPatternConverter : PatternConverter {
+ override protected void Convert(TextWriter writer, object state) {
Environment.SpecialFolder specialFolder = (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), base.Option, true);
writer.Write(Environment.GetFolderPath(specialFolder));
}
diff --git a/GreenshotPlugin/Core/NetworkHelper.cs b/GreenshotPlugin/Core/NetworkHelper.cs
index dbf188912..1393cb9ac 100644
--- a/GreenshotPlugin/Core/NetworkHelper.cs
+++ b/GreenshotPlugin/Core/NetworkHelper.cs
@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Globalization;
using System.IO;
using System.Net;
using System.Net.Security;
@@ -29,18 +30,19 @@ using System.Text;
using System.Text.RegularExpressions;
using Greenshot.IniFile;
using Greenshot.Plugin;
+using log4net;
namespace GreenshotPlugin.Core {
///
/// Description of NetworkHelper.
///
public static class NetworkHelper {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(NetworkHelper));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(NetworkHelper));
private static CoreConfiguration config = IniConfig.GetIniSection();
static NetworkHelper() {
// Disable certificate checking
- System.Net.ServicePointManager.ServerCertificateValidationCallback +=
+ ServicePointManager.ServerCertificateValidationCallback +=
delegate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslError) {
bool validationResult = true;
return validationResult;
@@ -52,10 +54,10 @@ namespace GreenshotPlugin.Core {
/// An Uri to specify the download location
/// string with the file content
public static string GetAsString(Uri url) {
- HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
+ HttpWebRequest webRequest = (HttpWebRequest)CreateWebRequest(url);
webRequest.Method = "GET";
webRequest.KeepAlive = true;
- webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
+ webRequest.Credentials = CredentialCache.DefaultCredentials;
return GetResponse(webRequest);
}
@@ -67,7 +69,7 @@ namespace GreenshotPlugin.Core {
public static Bitmap DownloadFavIcon(Uri baseUri) {
Uri url = new Uri(baseUri, new Uri("favicon.ico"));
try {
- HttpWebRequest request = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
+ HttpWebRequest request = (HttpWebRequest)CreateWebRequest(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (request.HaveResponse) {
using (Image image = Image.FromStream(response.GetResponseStream())) {
@@ -88,7 +90,7 @@ namespace GreenshotPlugin.Core {
/// Bitmap
public static Image DownloadImage(string url) {
try {
- HttpWebRequest request = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
+ HttpWebRequest request = (HttpWebRequest)CreateWebRequest(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (request.HaveResponse) {
using (Image image = Image.FromStream(response.GetResponseStream())) {
@@ -118,7 +120,7 @@ namespace GreenshotPlugin.Core {
public static WebRequest CreateWebRequest(Uri uri) {
WebRequest webRequest = WebRequest.Create(uri);
if (config.UseProxy) {
- webRequest.Proxy = GreenshotPlugin.Core.NetworkHelper.CreateProxy(uri);
+ webRequest.Proxy = CreateProxy(uri);
//webRequest.Proxy.Credentials = CredentialCache.DefaultCredentials;
}
return webRequest;
@@ -166,7 +168,7 @@ namespace GreenshotPlugin.Core {
public static string UrlEncode(string text) {
if (!string.IsNullOrEmpty(text)) {
// Sytem.Uri provides reliable parsing, but doesn't encode spaces.
- return System.Uri.EscapeDataString(text).Replace("%20", "+");
+ return Uri.EscapeDataString(text).Replace("%20", "+");
}
return null;
}
@@ -200,7 +202,7 @@ namespace GreenshotPlugin.Core {
// pre-process for + sign space formatting since System.Uri doesn't handle it
// plus literals are encoded as %2b normally so this should be safe
text = text.Replace("+", " ");
- return System.Uri.UnescapeDataString(text);
+ return Uri.UnescapeDataString(text);
}
///
@@ -246,7 +248,7 @@ namespace GreenshotPlugin.Core {
StringBuilder sb = new StringBuilder();
foreach(string key in queryParameters.Keys) {
- sb.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "{0}={1}&", key, UrlEncode(string.Format("{0}",queryParameters[key])));
+ sb.AppendFormat(CultureInfo.InvariantCulture, "{0}={1}&", key, UrlEncode(string.Format("{0}",queryParameters[key])));
}
sb.Remove(sb.Length-1,1);
@@ -363,12 +365,12 @@ namespace GreenshotPlugin.Core {
}
public ByteContainer(byte[] file, string filename, string contenttype, int filesize) {
this.file = file;
- this.fileName = filename;
- this.contentType = contenttype;
+ fileName = filename;
+ contentType = contenttype;
if (filesize == 0) {
- this.fileSize = file.Length;
+ fileSize = file.Length;
} else {
- this.fileSize = filesize;
+ fileSize = filesize;
}
}
@@ -377,7 +379,7 @@ namespace GreenshotPlugin.Core {
///
/// string
public string ToBase64String(Base64FormattingOptions formattingOptions) {
- return System.Convert.ToBase64String(file, 0, fileSize, formattingOptions);
+ return Convert.ToBase64String(file, 0, fileSize, formattingOptions);
}
///
@@ -440,7 +442,7 @@ namespace GreenshotPlugin.Core {
public BitmapContainer(Bitmap bitmap, SurfaceOutputSettings outputSettings, string filename) {
this.bitmap = bitmap;
this.outputSettings = outputSettings;
- this.fileName = filename;
+ fileName = filename;
}
///
@@ -451,7 +453,7 @@ namespace GreenshotPlugin.Core {
public string ToBase64String(Base64FormattingOptions formattingOptions) {
using (MemoryStream stream = new MemoryStream()) {
ImageOutput.SaveToStream(bitmap, null, stream, outputSettings);
- return System.Convert.ToBase64String(stream.GetBuffer(), 0, (int)stream.Length, formattingOptions);
+ return Convert.ToBase64String(stream.GetBuffer(), 0, (int)stream.Length, formattingOptions);
}
}
@@ -516,7 +518,7 @@ namespace GreenshotPlugin.Core {
public SurfaceContainer(ISurface surface, SurfaceOutputSettings outputSettings, string filename) {
this.surface = surface;
this.outputSettings = outputSettings;
- this.fileName = filename;
+ fileName = filename;
}
///
@@ -527,7 +529,7 @@ namespace GreenshotPlugin.Core {
public string ToBase64String(Base64FormattingOptions formattingOptions) {
using (MemoryStream stream = new MemoryStream()) {
ImageOutput.SaveToStream(surface, stream, outputSettings);
- return System.Convert.ToBase64String(stream.GetBuffer(), 0, (int)stream.Length, formattingOptions);
+ return Convert.ToBase64String(stream.GetBuffer(), 0, (int)stream.Length, formattingOptions);
}
}
diff --git a/GreenshotPlugin/Core/OAuthHelper.cs b/GreenshotPlugin/Core/OAuthHelper.cs
index 4dba847fe..1c2e642cd 100644
--- a/GreenshotPlugin/Core/OAuthHelper.cs
+++ b/GreenshotPlugin/Core/OAuthHelper.cs
@@ -21,11 +21,14 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Globalization;
using System.Net;
using System.Security.Cryptography;
using System.Text;
+using System.Threading;
using GreenshotPlugin.Controls;
using System.Security.Cryptography.X509Certificates;
+using log4net;
namespace GreenshotPlugin.Core {
///
@@ -40,7 +43,7 @@ namespace GreenshotPlugin.Core {
public enum HTTPMethod { GET, POST, PUT, DELETE };
public class OAuthSession {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OAuthSession));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(OAuthSession));
protected const string OAUTH_VERSION = "1.0";
protected const string OAUTH_PARAMETER_PREFIX = "oauth_";
@@ -207,11 +210,11 @@ namespace GreenshotPlugin.Core {
public OAuthSession(string consumerKey, string consumerSecret) {
this.consumerKey = consumerKey;
this.consumerSecret = consumerSecret;
- this.UseMultipartFormData = true;
- this.RequestTokenMethod = HTTPMethod.GET;
- this.AccessTokenMethod = HTTPMethod.GET;
- this.SignatureType = OAuthSignatureTypes.HMACSHA1;
- this.AutoLogin = true;
+ UseMultipartFormData = true;
+ RequestTokenMethod = HTTPMethod.GET;
+ AccessTokenMethod = HTTPMethod.GET;
+ SignatureType = OAuthSignatureTypes.HMACSHA1;
+ AutoLogin = true;
}
///
@@ -250,7 +253,7 @@ namespace GreenshotPlugin.Core {
StringBuilder sb = new StringBuilder();
foreach (string key in queryParameters.Keys) {
if (queryParameters[key] is string) {
- sb.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "{0}={1}&", key, UrlEncode3986(string.Format("{0}",queryParameters[key])));
+ sb.AppendFormat(CultureInfo.InvariantCulture, "{0}={1}&", key, UrlEncode3986(string.Format("{0}",queryParameters[key])));
}
}
sb.Remove(sb.Length - 1, 1);
@@ -318,9 +321,9 @@ namespace GreenshotPlugin.Core {
LOG.DebugFormat("Request token response: {0}", response);
requestTokenResponseParameters = NetworkHelper.ParseQueryString(response);
if (requestTokenResponseParameters.ContainsKey(OAUTH_TOKEN_KEY)) {
- this.Token = requestTokenResponseParameters[OAUTH_TOKEN_KEY];
- this.TokenSecret = requestTokenResponseParameters[OAUTH_TOKEN_SECRET_KEY];
- ret = this.Token;
+ Token = requestTokenResponseParameters[OAUTH_TOKEN_KEY];
+ TokenSecret = requestTokenResponseParameters[OAUTH_TOKEN_SECRET_KEY];
+ ret = Token;
}
}
return ret;
@@ -377,10 +380,10 @@ namespace GreenshotPlugin.Core {
LOG.DebugFormat("Access token response: {0}", response);
accessTokenResponseParameters = NetworkHelper.ParseQueryString(response);
if (accessTokenResponseParameters.ContainsKey(OAUTH_TOKEN_KEY) && accessTokenResponseParameters[OAUTH_TOKEN_KEY] != null) {
- this.Token = accessTokenResponseParameters[OAUTH_TOKEN_KEY];
+ Token = accessTokenResponseParameters[OAUTH_TOKEN_KEY];
}
if (accessTokenResponseParameters.ContainsKey(OAUTH_TOKEN_SECRET_KEY) && accessTokenResponseParameters[OAUTH_TOKEN_SECRET_KEY] != null) {
- this.TokenSecret = accessTokenResponseParameters[OAUTH_TOKEN_SECRET_KEY];
+ TokenSecret = accessTokenResponseParameters[OAUTH_TOKEN_SECRET_KEY];
}
}
@@ -392,9 +395,9 @@ namespace GreenshotPlugin.Core {
///
/// true if the process is completed
public bool Authorize() {
- this.Token = null;
- this.TokenSecret = null;
- this.Verifier = null;
+ Token = null;
+ TokenSecret = null;
+ Verifier = null;
LOG.Debug("Creating Token");
try {
getRequestToken();
@@ -407,7 +410,7 @@ namespace GreenshotPlugin.Core {
return false;
}
try {
- System.Threading.Thread.Sleep(1000);
+ Thread.Sleep(1000);
return getAccessToken() != null;
} catch (Exception ex) {
LOG.Error(ex);
@@ -421,7 +424,7 @@ namespace GreenshotPlugin.Core {
/// The url with a valid request token, or a null string.
private string authorizationLink {
get {
- return AuthorizeUrl + "?" + OAUTH_TOKEN_KEY + "=" + this.Token + "&" + OAUTH_CALLBACK_KEY + "=" + UrlEncode3986(CallbackUrl);
+ return AuthorizeUrl + "?" + OAUTH_TOKEN_KEY + "=" + Token + "&" + OAUTH_CALLBACK_KEY + "=" + UrlEncode3986(CallbackUrl);
}
}
@@ -552,7 +555,7 @@ namespace GreenshotPlugin.Core {
// Add normalized URL
Uri url = new Uri(requestURL);
- string normalizedUrl = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}://{1}", url.Scheme, url.Host);
+ string normalizedUrl = string.Format(CultureInfo.InvariantCulture, "{0}://{1}", url.Scheme, url.Host);
if (!((url.Scheme == "http" && url.Port == 80) || (url.Scheme == "https" && url.Port == 443))) {
normalizedUrl += ":" + url.Port;
}
@@ -587,7 +590,7 @@ namespace GreenshotPlugin.Core {
}
signatureBase.Append(UrlEncode3986(GenerateNormalizedParametersString(parameters)));
LOG.DebugFormat("Signature base: {0}", signatureBase);
- string key = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}&{1}", UrlEncode3986(consumerSecret), string.IsNullOrEmpty(TokenSecret) ? string.Empty : UrlEncode3986(TokenSecret));
+ string key = string.Format(CultureInfo.InvariantCulture, "{0}&{1}", UrlEncode3986(consumerSecret), string.IsNullOrEmpty(TokenSecret) ? string.Empty : UrlEncode3986(TokenSecret));
switch (SignatureType) {
case OAuthSignatureTypes.RSASHA1:
// Code comes from here: http://www.dotnetfunda.com/articles/article1932-rest-service-call-using-oauth-10-authorization-with-rsa-sha1.aspx
@@ -601,7 +604,7 @@ namespace GreenshotPlugin.Core {
// Create a RSA-SHA1 Hash object
using (SHA1Managed shaHASHObject = new SHA1Managed()) {
// Create Byte Array of Signature base string
- byte[] data = System.Text.Encoding.ASCII.GetBytes(signatureBase.ToString());
+ byte[] data = Encoding.ASCII.GetBytes(signatureBase.ToString());
// Create Hashmap of Signature base string
byte[] hash = shaHASHObject.ComputeHash(data);
// Create Sign Hash of base string
@@ -649,7 +652,7 @@ namespace GreenshotPlugin.Core {
requestParameters = new Dictionary();
foreach (string parameterKey in parameters.Keys) {
if (parameterKey.StartsWith(OAUTH_PARAMETER_PREFIX)) {
- authHeader.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "{0}=\"{1}\", ", parameterKey, UrlEncode3986(string.Format("{0}",parameters[parameterKey])));
+ authHeader.AppendFormat(CultureInfo.InvariantCulture, "{0}=\"{1}\", ", parameterKey, UrlEncode3986(string.Format("{0}",parameters[parameterKey])));
} else if (!requestParameters.ContainsKey(parameterKey)) {
requestParameters.Add(parameterKey, parameters[parameterKey]);
}
@@ -694,9 +697,9 @@ namespace GreenshotPlugin.Core {
foreach (string parameterKey in requestParameters.Keys) {
if (parameters[parameterKey] is IBinaryContainer) {
IBinaryContainer binaryParameter = parameters[parameterKey] as IBinaryContainer;
- form.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "{0}={1}&", UrlEncode3986(parameterKey), UrlEncode3986(binaryParameter.ToBase64String(Base64FormattingOptions.None)));
+ form.AppendFormat(CultureInfo.InvariantCulture, "{0}={1}&", UrlEncode3986(parameterKey), UrlEncode3986(binaryParameter.ToBase64String(Base64FormattingOptions.None)));
} else {
- form.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "{0}={1}&", UrlEncode3986(parameterKey), UrlEncode3986(string.Format("{0}",parameters[parameterKey])));
+ form.AppendFormat(CultureInfo.InvariantCulture, "{0}={1}&", UrlEncode3986(parameterKey), UrlEncode3986(string.Format("{0}",parameters[parameterKey])));
}
}
// Remove trailing &
diff --git a/GreenshotPlugin/Core/PluginUtils.cs b/GreenshotPlugin/Core/PluginUtils.cs
index 42851a679..c72574a2c 100644
--- a/GreenshotPlugin/Core/PluginUtils.cs
+++ b/GreenshotPlugin/Core/PluginUtils.cs
@@ -23,6 +23,7 @@ using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Greenshot.Plugin;
+using log4net;
using Microsoft.Win32;
namespace GreenshotPlugin.Core {
@@ -30,7 +31,7 @@ namespace GreenshotPlugin.Core {
/// Description of PluginUtils.
///
public static class PluginUtils {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PluginUtils));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(PluginUtils));
private const string PATH_KEY = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\";
///
@@ -96,8 +97,8 @@ namespace GreenshotPlugin.Core {
/// The TAG value
/// Keys which can be used as shortcut
/// The onclick handler
- public static void AddToFileMenu(IImageEditor imageEditor, Image image, string text, object tag, Keys? shortcutKeys, System.EventHandler handler) {
- System.Windows.Forms.ToolStripMenuItem item = new System.Windows.Forms.ToolStripMenuItem();
+ public static void AddToFileMenu(IImageEditor imageEditor, Image image, string text, object tag, Keys? shortcutKeys, EventHandler handler) {
+ ToolStripMenuItem item = new ToolStripMenuItem();
item.Image = image;
item.Text = text;
item.Tag = tag;
diff --git a/GreenshotPlugin/Core/QuantizerHelper.cs b/GreenshotPlugin/Core/QuantizerHelper.cs
index 1b0883d8e..31148dfca 100644
--- a/GreenshotPlugin/Core/QuantizerHelper.cs
+++ b/GreenshotPlugin/Core/QuantizerHelper.cs
@@ -23,6 +23,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
+using log4net;
namespace GreenshotPlugin.Core {
internal class WuColorCube {
@@ -70,7 +71,7 @@ namespace GreenshotPlugin.Core {
}
public class WuQuantizer : IDisposable {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WuQuantizer));
+ private static ILog LOG = LogManager.GetLogger(typeof(WuQuantizer));
private const Int32 MAXCOLOR = 512;
private const Int32 RED = 2;
diff --git a/GreenshotPlugin/Core/SourceForgeHelper.cs b/GreenshotPlugin/Core/SourceForgeHelper.cs
index 48dabbc3b..49ca5041c 100644
--- a/GreenshotPlugin/Core/SourceForgeHelper.cs
+++ b/GreenshotPlugin/Core/SourceForgeHelper.cs
@@ -24,6 +24,7 @@ using System.Globalization;
using System.Net;
using System.Text.RegularExpressions;
using System.Xml;
+using log4net;
namespace GreenshotPlugin.Core {
public class SourceforgeFile {
@@ -94,7 +95,7 @@ namespace GreenshotPlugin.Core {
/// Description of SourceForgeHelper.
///
public class SourceForgeHelper {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(SourceForgeHelper));
+ private static ILog LOG = LogManager.GetLogger(typeof(SourceForgeHelper));
private const String RSSFEED = "http://getgreenshot.org/project-feed/";
///
diff --git a/GreenshotPlugin/Core/WindowCapture.cs b/GreenshotPlugin/Core/WindowCapture.cs
index 6727389b8..38d1e01c9 100644
--- a/GreenshotPlugin/Core/WindowCapture.cs
+++ b/GreenshotPlugin/Core/WindowCapture.cs
@@ -28,6 +28,7 @@ using System.Windows.Forms;
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.UnmanagedHelpers;
+using log4net;
namespace GreenshotPlugin.Core {
///
@@ -132,7 +133,7 @@ namespace GreenshotPlugin.Core {
/// Having the Bitmap, eventually the Windows Title and cursor all together.
///
public class Capture : IDisposable, ICapture {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(Capture));
+ private static ILog LOG = LogManager.GetLogger(typeof(Capture));
private List elements = new List();
private Rectangle screenBounds;
@@ -165,7 +166,7 @@ namespace GreenshotPlugin.Core {
LOG.Debug("Converting Bitmap to PixelFormat.Format32bppArgb as we don't support: " + value.PixelFormat);
try {
// Default Bitmap PixelFormat is Format32bppArgb
- this.image = new Bitmap(value);
+ image = new Bitmap(value);
} finally {
// Always dispose, even when a exception occured
value.Dispose();
@@ -246,7 +247,7 @@ namespace GreenshotPlugin.Core {
///
/// Image
public Capture(Image newImage) : this() {
- this.Image = newImage;
+ Image = newImage;
}
///
@@ -425,7 +426,7 @@ namespace GreenshotPlugin.Core {
/// The Window Capture code
///
public class WindowCapture {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WindowCapture));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(WindowCapture));
private static CoreConfiguration conf = IniConfig.GetIniSection();
///
diff --git a/GreenshotPlugin/Core/WindowsHelper.cs b/GreenshotPlugin/Core/WindowsHelper.cs
index 054d0335a..47be6adab 100644
--- a/GreenshotPlugin/Core/WindowsHelper.cs
+++ b/GreenshotPlugin/Core/WindowsHelper.cs
@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
@@ -33,13 +34,14 @@ using Greenshot.IniFile;
using Greenshot.Interop;
using Greenshot.Plugin;
using GreenshotPlugin.UnmanagedHelpers;
-
///
/// Code for handling with "windows"
/// Main code is taken from vbAccelerator, location:
/// http://www.vbaccelerator.com/home/NET/Code/Libraries/Windows/Enumerating_Windows/article.asp
/// but a LOT of changes/enhancements were made to adapt it for Greenshot.
///
+using log4net;
+
namespace GreenshotPlugin.Core {
#region EnumWindows
///
@@ -56,7 +58,7 @@ namespace GreenshotPlugin.Core {
///
public List Items {
get {
- return this.items;
+ return items;
}
}
@@ -87,9 +89,9 @@ namespace GreenshotPlugin.Core {
/// Window Handle to get children for
/// Window Classname to copy, use null to copy all
public WindowsEnumerator GetWindows(IntPtr hWndParent, string classname) {
- this.items = new List();
+ items = new List();
List windows = new List();
- User32.EnumChildWindows(hWndParent, new EnumWindowsProc(this.WindowEnum), 0);
+ User32.EnumChildWindows(hWndParent, new EnumWindowsProc(WindowEnum), 0);
bool hasParent = !IntPtr.Zero.Equals(hWndParent);
string parentText = null;
@@ -120,7 +122,7 @@ namespace GreenshotPlugin.Core {
/// Application defined value
/// 1 to continue enumeration, 0 to stop
private int WindowEnum(IntPtr hWnd, int lParam) {
- if (this.OnWindowEnum(hWnd)) {
+ if (OnWindowEnum(hWnd)) {
return 1;
} else {
return 0;
@@ -159,13 +161,13 @@ namespace GreenshotPlugin.Core {
/// Provides details about a Window returned by the
/// enumeration
///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable")]
+ [SuppressMessage("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable")]
public class WindowDetails : IEquatable{
private const string METRO_WINDOWS_CLASS = "Windows.UI.Core.CoreWindow";
private const string METRO_APPLAUNCHER_CLASS = "ImmersiveLauncher";
private const string METRO_GUTTER_CLASS = "ImmersiveGutter";
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(WindowDetails));
+ private static ILog LOG = LogManager.GetLogger(typeof(WindowDetails));
private static Dictionary> classnameTree = new Dictionary>();
private static CoreConfiguration conf = IniConfig.GetIniSection();
private static List ignoreHandles = new List();
@@ -241,19 +243,19 @@ namespace GreenshotPlugin.Core {
}
public override bool Equals(object right) {
- return this.Equals(right as WindowDetails);
+ return Equals(right as WindowDetails);
}
public bool Equals(WindowDetails other) {
- if (Object.ReferenceEquals(other, null)) {
+ if (ReferenceEquals(other, null)) {
return false;
}
- if (Object.ReferenceEquals(this, other)) {
+ if (ReferenceEquals(this, other)) {
return true;
}
- if (this.GetType() != other.GetType()){
+ if (GetType() != other.GetType()){
return false;
}
return other.Handle == Handle;
@@ -292,7 +294,7 @@ namespace GreenshotPlugin.Core {
public Image DisplayIcon {
get {
try {
- using (Icon appIcon = GetAppIcon(this.Handle)) {
+ using (Icon appIcon = GetAppIcon(Handle)) {
if (appIcon != null) {
return appIcon.ToBitmap();
}
@@ -590,7 +592,7 @@ namespace GreenshotPlugin.Core {
///
public IntPtr Handle {
get {
- return this.hWnd;
+ return hWnd;
}
}
@@ -605,7 +607,7 @@ namespace GreenshotPlugin.Core {
get {
if (text == null) {
StringBuilder title = new StringBuilder(260, 260);
- User32.GetWindowText(this.hWnd, title, title.Capacity);
+ User32.GetWindowText(hWnd, title, title.Capacity);
text = title.ToString();
}
return text;
@@ -619,7 +621,7 @@ namespace GreenshotPlugin.Core {
public string ClassName {
get {
if (className == null) {
- className = GetClassName(this.hWnd);
+ className = GetClassName(hWnd);
}
return className;
}
@@ -633,13 +635,13 @@ namespace GreenshotPlugin.Core {
if (isMetroApp) {
return !Visible;
}
- return User32.IsIconic(this.hWnd) || Location.X <= -32000;
+ return User32.IsIconic(hWnd) || Location.X <= -32000;
}
set {
if (value) {
- User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
+ User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
} else {
- User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
+ User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
}
}
}
@@ -662,13 +664,13 @@ namespace GreenshotPlugin.Core {
}
return false;
}
- return User32.IsZoomed(this.hWnd);
+ return User32.IsZoomed(hWnd);
}
set {
if (value) {
- User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero);
+ User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero);
} else {
- User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
+ User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
}
}
}
@@ -718,7 +720,7 @@ namespace GreenshotPlugin.Core {
if (isAppLauncher) {
return IsAppLauncherVisible;
}
- return User32.IsWindowVisible(this.hWnd);
+ return User32.IsWindowVisible(hWnd);
}
}
@@ -846,10 +848,10 @@ namespace GreenshotPlugin.Core {
///
public void Restore() {
if (Iconic) {
- User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
+ User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
}
- User32.BringWindowToTop(this.hWnd);
- User32.SetForegroundWindow(this.hWnd);
+ User32.BringWindowToTop(hWnd);
+ User32.SetForegroundWindow(hWnd);
// Make sure windows has time to perform the action
while(Iconic) {
Application.DoEvents();
@@ -861,10 +863,10 @@ namespace GreenshotPlugin.Core {
///
public WindowStyleFlags WindowStyle {
get {
- return (WindowStyleFlags)User32.GetWindowLongWrapper(this.hWnd, (int)WindowLongIndex.GWL_STYLE);
+ return (WindowStyleFlags)User32.GetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_STYLE);
}
set {
- User32.SetWindowLongWrapper(this.hWnd, (int)WindowLongIndex.GWL_STYLE, (uint)value);
+ User32.SetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_STYLE, (uint)value);
}
}
@@ -874,11 +876,11 @@ namespace GreenshotPlugin.Core {
public WindowPlacement WindowPlacement {
get {
WindowPlacement placement = WindowPlacement.Default;
- User32.GetWindowPlacement(this.Handle, ref placement);
+ User32.GetWindowPlacement(Handle, ref placement);
return placement;
}
set {
- User32.SetWindowPlacement(this.Handle, ref value);
+ User32.SetWindowPlacement(Handle, ref value);
}
}
@@ -887,10 +889,10 @@ namespace GreenshotPlugin.Core {
///
public ExtendedWindowStyleFlags ExtendedWindowStyle {
get {
- return (ExtendedWindowStyleFlags)User32.GetWindowLongWrapper(this.hWnd, (int)WindowLongIndex.GWL_EXSTYLE);
+ return (ExtendedWindowStyleFlags)User32.GetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_EXSTYLE);
}
set {
- User32.SetWindowLongWrapper(this.hWnd, (int)WindowLongIndex.GWL_EXSTYLE, (uint)value);
+ User32.SetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_EXSTYLE, (uint)value);
}
}
@@ -1015,7 +1017,7 @@ namespace GreenshotPlugin.Core {
try {
// Check if we make a transparent capture
if (windowCaptureMode == WindowCaptureMode.AeroTransparent) {
- frozen = this.FreezeWindow();
+ frozen = FreezeWindow();
// Use white, later black to capture transparent
tempForm.BackColor = Color.White;
// Make sure everything is visible
@@ -1073,7 +1075,7 @@ namespace GreenshotPlugin.Core {
// Not needed for Windows 8
if (!(Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 2)) {
// Only if the Inivalue is set, not maximized and it's not a tool window.
- if (conf.WindowCaptureRemoveCorners && !Maximised && (this.ExtendedWindowStyle & ExtendedWindowStyleFlags.WS_EX_TOOLWINDOW) == 0) {
+ if (conf.WindowCaptureRemoveCorners && !Maximised && (ExtendedWindowStyle & ExtendedWindowStyleFlags.WS_EX_TOOLWINDOW) == 0) {
// Remove corners
if (!Image.IsAlphaPixelFormat(capturedBitmap.PixelFormat)) {
LOG.Debug("Changing pixelformat to Alpha for the RemoveCorners");
@@ -1088,7 +1090,7 @@ namespace GreenshotPlugin.Core {
} finally {
// Make sure to ALWAYS unfreeze!!
if (frozen) {
- this.UnfreezeWindow();
+ UnfreezeWindow();
}
}
@@ -1251,7 +1253,7 @@ namespace GreenshotPlugin.Core {
/// Set the window as foreground window
///
public void ToForeground() {
- ToForeground(this.Handle);
+ ToForeground(Handle);
}
///
@@ -1290,7 +1292,7 @@ namespace GreenshotPlugin.Core {
/// Warning: Use only if no other way!!
///
private bool FreezeWindow() {
- Process proc = Process.GetProcessById(this.ProcessId.ToInt32());
+ Process proc = Process.GetProcessById(ProcessId.ToInt32());
string processName = proc.ProcessName;
if (!CanFreezeOrUnfreeze(processName)) {
LOG.DebugFormat("Not freezing {0}", processName);
@@ -1320,7 +1322,7 @@ namespace GreenshotPlugin.Core {
/// Unfreeze the process belonging to the window
///
public void UnfreezeWindow() {
- Process proc = Process.GetProcessById(this.ProcessId.ToInt32());
+ Process proc = Process.GetProcessById(ProcessId.ToInt32());
string processName = proc.ProcessName;
if (!CanFreezeOrUnfreeze(processName)) {
@@ -1390,7 +1392,7 @@ namespace GreenshotPlugin.Core {
}
return null;
}
- if (!HasParent && this.Maximised) {
+ if (!HasParent && Maximised) {
LOG.Debug("Correcting for maximalization");
Size borderSize = Size.Empty;
GetBorderSize(out borderSize);
@@ -1417,13 +1419,13 @@ namespace GreenshotPlugin.Core {
IntPtr hWnd = User32.GetForegroundWindow();
if (hWnd != null && hWnd != IntPtr.Zero) {
if (ignoreHandles.Contains(hWnd)) {
- return WindowDetails.GetDesktopWindow();
+ return GetDesktopWindow();
}
WindowDetails activeWindow = new WindowDetails(hWnd);
// Invisible Windows should not be active
if (!activeWindow.Visible) {
- return WindowDetails.GetDesktopWindow();
+ return GetDesktopWindow();
}
return activeWindow;
}
@@ -1507,7 +1509,7 @@ namespace GreenshotPlugin.Core {
List windows = new List();
Rectangle screenBounds = WindowCapture.GetScreenBounds();
List allWindows = GetMetroApps();
- allWindows.AddRange(WindowDetails.GetAllWindows());
+ allWindows.AddRange(GetAllWindows());
foreach(WindowDetails window in allWindows) {
// Ignore windows without title
if (window.Text.Length == 0) {
@@ -1581,7 +1583,7 @@ namespace GreenshotPlugin.Core {
public static List GetTopLevelWindows() {
List windows = new List();
var possibleTopLevelWindows = GetMetroApps();
- possibleTopLevelWindows.AddRange(WindowDetails.GetAllWindows());
+ possibleTopLevelWindows.AddRange(GetAllWindows());
foreach (WindowDetails window in possibleTopLevelWindows) {
// Ignore windows without title
if (window.Text.Length == 0) {
@@ -1621,7 +1623,7 @@ namespace GreenshotPlugin.Core {
///
public static WindowDetails GetLinkedWindow(WindowDetails windowToLinkTo) {
IntPtr processIdSelectedWindow = windowToLinkTo.ProcessId;
- foreach(WindowDetails window in WindowDetails.GetAllWindows()) {
+ foreach(WindowDetails window in GetAllWindows()) {
// Ignore windows without title
if (window.Text.Length == 0) {
continue;
@@ -1657,7 +1659,7 @@ namespace GreenshotPlugin.Core {
///
/// List with old windows
public static void ActiveNewerWindows(List oldWindows) {
- List windowsAfter = WindowDetails.GetVisibleWindows();
+ List windowsAfter = GetVisibleWindows();
foreach(WindowDetails window in windowsAfter) {
if (!oldWindows.Contains(window)) {
window.ToForeground();
diff --git a/GreenshotPlugin/IEInterop/IHTMLBodyElement.cs b/GreenshotPlugin/IEInterop/IHTMLBodyElement.cs
index 38c183add..0aeda51e4 100644
--- a/GreenshotPlugin/IEInterop/IHTMLBodyElement.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLBodyElement.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050F1D8-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLBodyElement {
string scroll {
set;
diff --git a/GreenshotPlugin/IEInterop/IHTMLCurrentStyle.cs b/GreenshotPlugin/IEInterop/IHTMLCurrentStyle.cs
index ea7c64056..006aa0961 100644
--- a/GreenshotPlugin/IEInterop/IHTMLCurrentStyle.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLCurrentStyle.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050f3db-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLCurrentStyle {
/// styleFloat property of IHTMLStyle interface.
string styleFloat {
diff --git a/GreenshotPlugin/IEInterop/IHTMLDocument.cs b/GreenshotPlugin/IEInterop/IHTMLDocument.cs
index a03f88fa4..09b769a0e 100644
--- a/GreenshotPlugin/IEInterop/IHTMLDocument.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLDocument.cs
@@ -26,7 +26,7 @@ namespace Greenshot.Interop.IE {
[Guid("626FC520-A41E-11CF-A731-00A0C9082637")]
[ComImport]
[TypeLibType(TypeLibTypeFlags.FDual)]
- [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLDocument {
object Script {
[return: MarshalAs(UnmanagedType.IDispatch)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLDocument2.cs b/GreenshotPlugin/IEInterop/IHTMLDocument2.cs
index e3975c6c4..6f14669b0 100644
--- a/GreenshotPlugin/IEInterop/IHTMLDocument2.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLDocument2.cs
@@ -26,7 +26,7 @@ namespace Greenshot.Interop.IE {
[Guid("332C4425-26CB-11D0-B483-00C04FD90119")]
[ComImport]
[TypeLibType(TypeLibTypeFlags.FDual)]
- [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLDocument2 {
IHTMLElement body {
[DispId(1004)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLDocument3.cs b/GreenshotPlugin/IEInterop/IHTMLDocument3.cs
index 973e12b26..fead78c6e 100644
--- a/GreenshotPlugin/IEInterop/IHTMLDocument3.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLDocument3.cs
@@ -26,7 +26,7 @@ namespace Greenshot.Interop.IE {
[Guid("3050F485-98B5-11CF-BB82-00AA00BDCE0B")]
[ComImport]
[TypeLibType(TypeLibTypeFlags.FDual)]
- [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLDocument3 {
IHTMLElement documentElement {
[DispId(1075)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLDocument4.cs b/GreenshotPlugin/IEInterop/IHTMLDocument4.cs
index 29beda42e..78b3eccc0 100644
--- a/GreenshotPlugin/IEInterop/IHTMLDocument4.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLDocument4.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComVisible(true), Guid("3050f69a-98b5-11cf-bb82-00aa00bdce0b"),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDual)]
public interface IHTMLDocument4 {
[DispId(1090)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLDocument5.cs b/GreenshotPlugin/IEInterop/IHTMLDocument5.cs
index c2836ba85..28cfd1084 100644
--- a/GreenshotPlugin/IEInterop/IHTMLDocument5.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLDocument5.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, ComVisible(true), Guid("3050f80c-98b5-11cf-bb82-00aa00bdce0b"),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDual)]
public interface IHTMLDocument5 {
[DispId(1102)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLElement.cs b/GreenshotPlugin/IEInterop/IHTMLElement.cs
index 96e2babb8..b2673ab96 100644
--- a/GreenshotPlugin/IEInterop/IHTMLElement.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLElement.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050F1FF-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLElement {
[DispId(-2147417611)]
void setAttribute([MarshalAs(UnmanagedType.BStr)] string strAttributeName, object AttributeValue, int lFlags);
diff --git a/GreenshotPlugin/IEInterop/IHTMLElement2.cs b/GreenshotPlugin/IEInterop/IHTMLElement2.cs
index a06610e1d..428498da6 100644
--- a/GreenshotPlugin/IEInterop/IHTMLElement2.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLElement2.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050F434-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLElement2 {
[DispId(-2147417067)]
[return: MarshalAs(UnmanagedType.IDispatch)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLElementCollection.cs b/GreenshotPlugin/IEInterop/IHTMLElementCollection.cs
index 992595290..3dbe36ca5 100644
--- a/GreenshotPlugin/IEInterop/IHTMLElementCollection.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLElementCollection.cs
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport(), ComVisible(true),
Guid("3050F21F-98B5-11CF-BB82-00AA00BDCE0B"),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDispatchable)]
public interface IHTMLElementCollection : IEnumerable {
new IEnumerator GetEnumerator();
diff --git a/GreenshotPlugin/IEInterop/IHTMLFrameBase.cs b/GreenshotPlugin/IEInterop/IHTMLFrameBase.cs
index fdee1c75a..85f122ac1 100644
--- a/GreenshotPlugin/IEInterop/IHTMLFrameBase.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLFrameBase.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComVisible(true), ComImport(), Guid("3050f311-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLFrameBase {
//dispinterface IHTMLFrameBase {
// properties:
diff --git a/GreenshotPlugin/IEInterop/IHTMLFramesCollection2.cs b/GreenshotPlugin/IEInterop/IHTMLFramesCollection2.cs
index af63530f3..7bc6b2630 100644
--- a/GreenshotPlugin/IEInterop/IHTMLFramesCollection2.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLFramesCollection2.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport(), ComVisible(true),
Guid("332C4426-26CB-11D0-B483-00C04FD90119"),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch),
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch),
TypeLibType(TypeLibTypeFlags.FDispatchable)]
public interface IHTMLFramesCollection2 {
[DispId(0)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLRect.cs b/GreenshotPlugin/IEInterop/IHTMLRect.cs
index 7ac5c6444..cd71e23a6 100644
--- a/GreenshotPlugin/IEInterop/IHTMLRect.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLRect.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050F4A3-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLRect {
int bottom {
[DispId(1004)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLScreen.cs b/GreenshotPlugin/IEInterop/IHTMLScreen.cs
index 95568dcfa..3f2013491 100644
--- a/GreenshotPlugin/IEInterop/IHTMLScreen.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLScreen.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050F35C-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLScreen {
[DispId(1003)]
int width {
diff --git a/GreenshotPlugin/IEInterop/IHTMLScreen2.cs b/GreenshotPlugin/IEInterop/IHTMLScreen2.cs
index 5bdd3318d..f868437ab 100644
--- a/GreenshotPlugin/IEInterop/IHTMLScreen2.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLScreen2.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050F84A-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLScreen2 {
int logicalXDPI {
[DispId(1009)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLSelectionObject.cs b/GreenshotPlugin/IEInterop/IHTMLSelectionObject.cs
index 8b51bf7d0..5389b957e 100644
--- a/GreenshotPlugin/IEInterop/IHTMLSelectionObject.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLSelectionObject.cs
@@ -25,7 +25,7 @@ namespace Greenshot.Interop.IE {
// See: http://msdn.microsoft.com/en-us/library/aa768849%28v=vs.85%29.aspx
[ComImport, Guid("3050f25A-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLSelectionObject {
[return: MarshalAs(UnmanagedType.IDispatch)]
[DispId(1001)]
diff --git a/GreenshotPlugin/IEInterop/IHTMLStyle.cs b/GreenshotPlugin/IEInterop/IHTMLStyle.cs
index 37764184a..d693ea9a9 100644
--- a/GreenshotPlugin/IEInterop/IHTMLStyle.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLStyle.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComImport, Guid("3050F25E-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLStyle {
/// setAttribute method of IHTMLStyle interface.
/// An original IDL definition of setAttribute method was the following: HRESULT setAttribute (BSTR strAttributeName, VARIANT AttributeValue, [optional, defaultvalue(1)] long lFlags);
diff --git a/GreenshotPlugin/IEInterop/IHTMLTxtRange.cs b/GreenshotPlugin/IEInterop/IHTMLTxtRange.cs
index 2c007e7f5..173c150c0 100644
--- a/GreenshotPlugin/IEInterop/IHTMLTxtRange.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLTxtRange.cs
@@ -25,7 +25,7 @@ namespace Greenshot.Interop.IE {
// See: http://msdn.microsoft.com/en-us/library/aa741548%28v=vs.85%29.aspx
[ComImport, Guid("3050F220-98B5-11CF-BB82-00AA00BDCE0B"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLTxtRange {
[DispId(1006)]
IHTMLElement parentElement();
diff --git a/GreenshotPlugin/IEInterop/IHTMLWindow2.cs b/GreenshotPlugin/IEInterop/IHTMLWindow2.cs
index 49fb920a8..2749a254d 100644
--- a/GreenshotPlugin/IEInterop/IHTMLWindow2.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLWindow2.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComVisible(true), ComImport(), Guid("332c4427-26cb-11d0-b483-00c04fd90119"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLWindow2 {
[DispId(1156)]
IHTMLScreen screen {
diff --git a/GreenshotPlugin/IEInterop/IHTMLWindow3.cs b/GreenshotPlugin/IEInterop/IHTMLWindow3.cs
index 275bc928c..f8d3cacf8 100644
--- a/GreenshotPlugin/IEInterop/IHTMLWindow3.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLWindow3.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComVisible(true), ComImport(), Guid("3050f4ae-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLWindow3 {
[DispId(1170)]
int screenLeft { get;}
diff --git a/GreenshotPlugin/IEInterop/IHTMLWindow4.cs b/GreenshotPlugin/IEInterop/IHTMLWindow4.cs
index 6b2aadfbf..078913e8c 100644
--- a/GreenshotPlugin/IEInterop/IHTMLWindow4.cs
+++ b/GreenshotPlugin/IEInterop/IHTMLWindow4.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop.IE {
[ComVisible(true), ComImport(), Guid("3050f6cf-98b5-11cf-bb82-00aa00bdce0b"),
TypeLibType(TypeLibTypeFlags.FDual),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
+ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IHTMLWindow4 {
[DispId(1181)]
IHTMLFrameBase frameElement {
diff --git a/GreenshotPlugin/IniFile/IniAttributes.cs b/GreenshotPlugin/IniFile/IniAttributes.cs
index e726963b8..53387e18c 100644
--- a/GreenshotPlugin/IniFile/IniAttributes.cs
+++ b/GreenshotPlugin/IniFile/IniAttributes.cs
@@ -46,7 +46,7 @@ namespace Greenshot.IniFile {
Separator = ",";
}
public IniPropertyAttribute(string name) : this() {
- this.Name = name;
+ Name = name;
}
public string Description {
get;
diff --git a/GreenshotPlugin/IniFile/IniConfig.cs b/GreenshotPlugin/IniFile/IniConfig.cs
index e63d39037..dd2345dd7 100644
--- a/GreenshotPlugin/IniFile/IniConfig.cs
+++ b/GreenshotPlugin/IniFile/IniConfig.cs
@@ -24,10 +24,11 @@ using System.IO;
using System.Reflection;
using System.Text;
using System.Threading;
+using log4net;
namespace Greenshot.IniFile {
public class IniConfig {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(IniConfig));
+ private static ILog LOG = LogManager.GetLogger(typeof(IniConfig));
private const string INI_EXTENSION = ".ini";
private const string DEFAULTS_POSTFIX = "-defaults";
private const string FIXED_POSTFIX = "-fixed";
@@ -358,7 +359,7 @@ namespace Greenshot.IniFile {
}
if (allowSave && section.IsDirty) {
LOG.DebugFormat("Section {0} is marked dirty, saving!", sectionName);
- IniConfig.Save();
+ Save();
}
return section;
}
diff --git a/GreenshotPlugin/IniFile/IniSection.cs b/GreenshotPlugin/IniFile/IniSection.cs
index 10cb4fe0b..358c25bdd 100644
--- a/GreenshotPlugin/IniFile/IniSection.cs
+++ b/GreenshotPlugin/IniFile/IniSection.cs
@@ -23,6 +23,7 @@ using System.Collections.Generic;
using System.Reflection;
using System.IO;
using GreenshotPlugin.Core;
+using log4net;
namespace Greenshot.IniFile {
///
@@ -30,7 +31,7 @@ namespace Greenshot.IniFile {
///
[Serializable]
public abstract class IniSection {
- protected static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(IniSection));
+ protected static ILog LOG = LogManager.GetLogger(typeof(IniSection));
[NonSerialized]
private IDictionary values = new Dictionary();
@@ -39,7 +40,7 @@ namespace Greenshot.IniFile {
public IniSectionAttribute IniSectionAttribute {
get {
if (iniSectionAttribute == null) {
- iniSectionAttribute = GetIniSectionAttribute(this.GetType());
+ iniSectionAttribute = GetIniSectionAttribute(GetType());
}
return iniSectionAttribute;
}
@@ -117,7 +118,7 @@ namespace Greenshot.IniFile {
///
///
public void Fill(Dictionary properties) {
- Type iniSectionType = this.GetType();
+ Type iniSectionType = GetType();
// Iterate over the members and create IniValueContainers
foreach (FieldInfo fieldInfo in iniSectionType.GetFields()) {
diff --git a/GreenshotPlugin/IniFile/IniValue.cs b/GreenshotPlugin/IniFile/IniValue.cs
index d9ab54fe0..b7376d661 100644
--- a/GreenshotPlugin/IniFile/IniValue.cs
+++ b/GreenshotPlugin/IniFile/IniValue.cs
@@ -24,13 +24,14 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Text;
+using log4net;
namespace Greenshot.IniFile {
///
/// A container to be able to pass the value from a IniSection around.
///
public class IniValue {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(IniValue));
+ private static ILog LOG = LogManager.GetLogger(typeof(IniValue));
private PropertyInfo propertyInfo;
private FieldInfo fieldInfo;
private IniSection containingIniSection;
@@ -39,13 +40,13 @@ namespace Greenshot.IniFile {
public IniValue(IniSection containingIniSection, PropertyInfo propertyInfo, IniPropertyAttribute iniPropertyAttribute) {
this.containingIniSection = containingIniSection;
this.propertyInfo = propertyInfo;
- this.attributes = iniPropertyAttribute;
+ attributes = iniPropertyAttribute;
}
public IniValue(IniSection containingIniSection, FieldInfo fieldInfo, IniPropertyAttribute iniPropertyAttribute) {
this.containingIniSection = containingIniSection;
this.fieldInfo = fieldInfo;
- this.attributes = iniPropertyAttribute;
+ attributes = iniPropertyAttribute;
}
///
@@ -318,7 +319,7 @@ namespace Greenshot.IniFile {
try {
LOG.WarnFormat("Problem '{0}' while converting {1} to type {2} trying fallback...", ex1.Message, propertyValue, valueType.FullName);
newValue = ConvertStringToValueType(valueType, defaultValue, attributes.Separator);
- this.ContainingIniSection.IsDirty = true;
+ ContainingIniSection.IsDirty = true;
LOG.InfoFormat("Used default value {0} for property {1}", defaultValue, propertyName);
} catch (Exception ex2) {
LOG.Warn("Problem converting fallback value " + defaultValue + " to type " + valueType.FullName, ex2);
diff --git a/GreenshotPlugin/Interfaces/Plugin/PluginInterfaces.cs b/GreenshotPlugin/Interfaces/Plugin/PluginInterfaces.cs
index 10da6ad53..fa885ae4a 100644
--- a/GreenshotPlugin/Interfaces/Plugin/PluginInterfaces.cs
+++ b/GreenshotPlugin/Interfaces/Plugin/PluginInterfaces.cs
@@ -30,7 +30,7 @@ using Greenshot.Core;
namespace Greenshot.Plugin {
[Serializable]
- [AttributeUsageAttribute(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
sealed public class PluginAttribute : Attribute, IComparable {
public string Name {
get;
@@ -59,8 +59,8 @@ namespace Greenshot.Plugin {
}
public PluginAttribute(string entryType, bool configurable) {
- this.EntryType = entryType;
- this.Configurable = configurable;
+ EntryType = entryType;
+ Configurable = configurable;
}
public int CompareTo(object obj) {
diff --git a/GreenshotPlugin/Interop/COMWrapper.cs b/GreenshotPlugin/Interop/COMWrapper.cs
index b791f87bd..94ab1a2b1 100644
--- a/GreenshotPlugin/Interop/COMWrapper.cs
+++ b/GreenshotPlugin/Interop/COMWrapper.cs
@@ -26,13 +26,14 @@ using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using System.Windows.Forms;
using GreenshotPlugin.Core;
+using log4net;
namespace Greenshot.Interop {
///
/// Wraps a late-bound COM server.
///
public sealed class COMWrapper : RealProxy, IDisposable, IRemotingTypeInfo {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(COMWrapper));
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(COMWrapper));
private const int MK_E_UNAVAILABLE = -2147221021;
private const int CO_E_CLASSSTRING = -2147221005;
public const int RPC_E_CALL_REJECTED = unchecked((int)0x80010001);
@@ -317,10 +318,10 @@ namespace Greenshot.Interop {
/// The interface type to impersonate.
///
private COMWrapper(object comObject, Type type, string targetName) : base(type) {
- this._COMObject = comObject;
- this._COMType = comObject.GetType();
- this._InterceptType = type;
- this._TargetName = targetName;
+ _COMObject = comObject;
+ _COMType = comObject.GetType();
+ _InterceptType = type;
+ _TargetName = targetName;
}
#endregion
@@ -332,15 +333,15 @@ namespace Greenshot.Interop {
/// sure that the COM object is still cleaned up.
///
~COMWrapper() {
- LOG.DebugFormat("Finalize {0}", this._InterceptType.ToString());
- this.Dispose(false);
+ LOG.DebugFormat("Finalize {0}", _InterceptType.ToString());
+ Dispose(false);
}
///
/// Cleans up the COM object.
///
public void Dispose() {
- this.Dispose(true);
+ Dispose(true);
GC.SuppressFinalize(this);
}
@@ -352,18 +353,18 @@ namespace Greenshot.Interop {
/// interface.
///
private void Dispose(bool disposing) {
- if (null != this._COMObject) {
- LOG.DebugFormat("Disposing {0}", this._InterceptType.ToString());
- if (Marshal.IsComObject(this._COMObject)) {
+ if (null != _COMObject) {
+ LOG.DebugFormat("Disposing {0}", _InterceptType.ToString());
+ if (Marshal.IsComObject(_COMObject)) {
try {
- while (Marshal.ReleaseComObject(this._COMObject) > 0) ;
+ while (Marshal.ReleaseComObject(_COMObject) > 0) ;
} catch (Exception ex) {
LOG.WarnFormat("Problem releasing {0}", _COMType);
LOG.Warn("Error: ", ex);
}
}
- this._COMObject = null;
+ _COMObject = null;
}
}
@@ -378,7 +379,7 @@ namespace Greenshot.Interop {
/// The full name of the intercepted type.
///
public override string ToString() {
- return this._InterceptType.FullName;
+ return _InterceptType.FullName;
}
///
@@ -388,7 +389,7 @@ namespace Greenshot.Interop {
/// The hash code of the wrapped object.
///
public override int GetHashCode() {
- return this._COMObject.GetHashCode();
+ return _COMObject.GetHashCode();
}
///
@@ -404,7 +405,7 @@ namespace Greenshot.Interop {
if (null != value && RemotingServices.IsTransparentProxy(value)) {
COMWrapper wrapper = RemotingServices.GetRealProxy(value) as COMWrapper;
if (null != wrapper) {
- return this._COMObject == wrapper._COMObject;
+ return _COMObject == wrapper._COMObject;
}
}
@@ -575,15 +576,15 @@ namespace Greenshot.Interop {
ParameterInfo parameter;
if ("Dispose" == methodName && 0 == argCount && typeof(void) == returnType) {
- this.Dispose();
+ Dispose();
} else if ("ToString" == methodName && 0 == argCount && typeof(string) == returnType) {
- returnValue = this.ToString();
- } else if ("GetType" == methodName && 0 == argCount && typeof(System.Type) == returnType) {
- returnValue = this._InterceptType;
+ returnValue = ToString();
+ } else if ("GetType" == methodName && 0 == argCount && typeof(Type) == returnType) {
+ returnValue = _InterceptType;
} else if ("GetHashCode" == methodName && 0 == argCount && typeof(int) == returnType) {
- returnValue = this.GetHashCode();
+ returnValue = GetHashCode();
} else if ("Equals" == methodName && 1 == argCount && typeof(bool) == returnType) {
- returnValue = this.Equals(callMessage.Args[0]);
+ returnValue = Equals(callMessage.Args[0]);
} else if (1 == argCount && typeof(void) == returnType && (methodName.StartsWith("add_") || methodName.StartsWith("remove_"))) {
bool removeHandler = methodName.StartsWith("remove_");
methodName = methodName.Substring(removeHandler ? 7 : 4);
@@ -593,8 +594,8 @@ namespace Greenshot.Interop {
return new ReturnMessage(new ArgumentNullException("handler"), callMessage);
}
} else {
- invokeObject = this._COMObject;
- invokeType = this._COMType;
+ invokeObject = _COMObject;
+ invokeType = _COMType;
if (methodName.StartsWith("get_")) {
// Property Get
@@ -670,7 +671,7 @@ namespace Greenshot.Interop {
if (comEx == null) {
comEx = ex.InnerException as COMException;
}
- if (comEx != null && (comEx.ErrorCode == RPC_E_CALL_REJECTED || comEx.ErrorCode == COMWrapper.RPC_E_FAIL)) {
+ if (comEx != null && (comEx.ErrorCode == RPC_E_CALL_REJECTED || comEx.ErrorCode == RPC_E_FAIL)) {
string destinationName = _TargetName;
// Try to find a "catchy" name for the rejecting application
if (destinationName != null && destinationName.Contains(".")) {
@@ -694,7 +695,7 @@ namespace Greenshot.Interop {
if (returnType.IsInterface) {
// Wrap the returned value in an intercepting COM wrapper
if (Marshal.IsComObject(returnValue)) {
- returnValue = COMWrapper.Wrap(returnValue, returnType, _TargetName);
+ returnValue = Wrap(returnValue, returnType, _TargetName);
}
} else if (returnType.IsEnum) {
// Convert to proper Enum type
diff --git a/GreenshotPlugin/Interop/IServiceProvider.cs b/GreenshotPlugin/Interop/IServiceProvider.cs
index 0be154eb7..0fa96c56d 100644
--- a/GreenshotPlugin/Interop/IServiceProvider.cs
+++ b/GreenshotPlugin/Interop/IServiceProvider.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
namespace Greenshot.Interop {
// This is the COM IServiceProvider interface, not System.IServiceProvider .Net interface!
[ComImport(), ComVisible(true), Guid("6D5140C1-7436-11CE-8034-00AA006009FA"),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IServiceProvider {
[return: MarshalAs(UnmanagedType.I4)][PreserveSig]
int QueryService(ref Guid guidService, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
diff --git a/GreenshotPlugin/UnmanagedHelpers/DWM.cs b/GreenshotPlugin/UnmanagedHelpers/DWM.cs
index 41490629e..511af1656 100644
--- a/GreenshotPlugin/UnmanagedHelpers/DWM.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/DWM.cs
@@ -117,10 +117,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern uint DwmEnableComposition(uint uCompositionAction);
public static void EnableComposition() {
- DWM.DwmEnableComposition(DWM.DWM_EC_ENABLECOMPOSITION);
+ DwmEnableComposition(DWM_EC_ENABLECOMPOSITION);
}
public static void DisableComposition() {
- DWM.DwmEnableComposition(DWM.DWM_EC_DISABLECOMPOSITION);
+ DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
}
// Key to ColorizationColor for DWM
@@ -139,7 +139,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
}
if (Environment.OSVersion.Version.Major >= 6) {
bool dwmEnabled;
- DWM.DwmIsCompositionEnabled(out dwmEnabled);
+ DwmIsCompositionEnabled(out dwmEnabled);
return dwmEnabled;
}
return false;
diff --git a/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs b/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs
index 9299ff079..a3beafc08 100644
--- a/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs
@@ -22,6 +22,7 @@ using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Security;
+using log4net;
using Microsoft.Win32.SafeHandles;
using System.Reflection;
using System.Drawing.Drawing2D;
@@ -93,7 +94,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
/// GDIplus Helpers
///
public static class GDIplus {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(GDIplus));
+ private static ILog LOG = LogManager.GetLogger(typeof(GDIplus));
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
private static extern int GdipBitmapApplyEffect(IntPtr bitmap, IntPtr effect, ref RECT rectOfInterest, bool useAuxData, IntPtr auxData, int auxDataSize);
diff --git a/GreenshotPlugin/UnmanagedHelpers/Kernel32.cs b/GreenshotPlugin/UnmanagedHelpers/Kernel32.cs
index e47e69f35..6c84b3b74 100644
--- a/GreenshotPlugin/UnmanagedHelpers/Kernel32.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/Kernel32.cs
@@ -76,23 +76,23 @@ namespace GreenshotPlugin.UnmanagedHelpers {
// Try the GetModuleFileName method first since it's the fastest.
// May return ACCESS_DENIED (due to VM_READ flag) if the process is not owned by the current user.
// Will fail if we are compiled as x86 and we're trying to open a 64 bit process...not allowed.
- IntPtr hprocess = Kernel32.OpenProcess(ProcessAccessFlags.QueryInformation | ProcessAccessFlags.VMRead, false, processid);
+ IntPtr hprocess = OpenProcess(ProcessAccessFlags.QueryInformation | ProcessAccessFlags.VMRead, false, processid);
if (hprocess != IntPtr.Zero) {
try {
if (PsAPI.GetModuleFileNameEx(hprocess, IntPtr.Zero, _PathBuffer, (uint)_PathBuffer.Capacity) > 0) {
return _PathBuffer.ToString();
}
} finally {
- Kernel32.CloseHandle(hprocess);
+ CloseHandle(hprocess);
}
}
- hprocess = Kernel32.OpenProcess(ProcessAccessFlags.QueryInformation, false, processid);
+ hprocess = OpenProcess(ProcessAccessFlags.QueryInformation, false, processid);
if (hprocess != IntPtr.Zero) {
try {
// Try this method for Vista or higher operating systems
uint size = (uint)_PathBuffer.Capacity;
- if ((Environment.OSVersion.Version.Major >= 6) && (Kernel32.QueryFullProcessImageName(hprocess, 0, _PathBuffer, ref size) && (size > 0))) {
+ if ((Environment.OSVersion.Version.Major >= 6) && (QueryFullProcessImageName(hprocess, 0, _PathBuffer, ref size) && (size > 0))) {
return _PathBuffer.ToString();
}
@@ -100,7 +100,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
if (PsAPI.GetProcessImageFileName(hprocess, _PathBuffer, (uint)_PathBuffer.Capacity) > 0) {
string dospath = _PathBuffer.ToString();
foreach (string drive in Environment.GetLogicalDrives()) {
- if (Kernel32.QueryDosDevice(drive.TrimEnd('\\'), _PathBuffer, (uint)_PathBuffer.Capacity) > 0) {
+ if (QueryDosDevice(drive.TrimEnd('\\'), _PathBuffer, (uint)_PathBuffer.Capacity) > 0) {
if (dospath.StartsWith(_PathBuffer.ToString())) {
return drive + dospath.Remove(0, _PathBuffer.Length);
}
@@ -108,7 +108,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
}
}
} finally {
- Kernel32.CloseHandle(hprocess);
+ CloseHandle(hprocess);
}
}
diff --git a/GreenshotPlugin/UnmanagedHelpers/Structs.cs b/GreenshotPlugin/UnmanagedHelpers/Structs.cs
index cb33fdafb..6f76a2230 100644
--- a/GreenshotPlugin/UnmanagedHelpers/Structs.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/Structs.cs
@@ -44,19 +44,19 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public int Y;
public POINT(int x, int y) {
- this.X = x;
- this.Y = y;
+ X = x;
+ Y = y;
}
public POINT(Point point) {
- this.X = point.X;
- this.Y = point.Y;
+ X = point.X;
+ Y = point.Y;
}
- public static implicit operator System.Drawing.Point(POINT p) {
- return new System.Drawing.Point(p.X, p.Y);
+ public static implicit operator Point(POINT p) {
+ return new Point(p.X, p.Y);
}
- public static implicit operator POINT(System.Drawing.Point p) {
+ public static implicit operator POINT(Point p) {
return new POINT(p.X, p.Y);
}
diff --git a/GreenshotPlugin/UnmanagedHelpers/User32.cs b/GreenshotPlugin/UnmanagedHelpers/User32.cs
index 69c57e49c..8f42370d1 100644
--- a/GreenshotPlugin/UnmanagedHelpers/User32.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/User32.cs
@@ -24,7 +24,7 @@ using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
-
+using System.Windows.Forms;
using Microsoft.Win32.SafeHandles;
using System.Security;
using System.Security.Permissions;
@@ -136,7 +136,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowScrollBar(IntPtr hwnd, ScrollBarDirection scrollBar, bool show);
[DllImport("user32", SetLastError = true)]
- public static extern int SetScrollPos(IntPtr hWnd, System.Windows.Forms.Orientation nBar, int nPos, bool bRedraw);
+ public static extern int SetScrollPos(IntPtr hWnd, Orientation nBar, int nPos, bool bRedraw);
[DllImport("user32", SetLastError=true, EntryPoint = "PostMessageA")]
public static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("user32", SetLastError = true)]
@@ -295,12 +295,12 @@ namespace GreenshotPlugin.UnmanagedHelpers {
}
public SafeIconHandle(IntPtr hIcon) : base(true) {
- this.SetHandle(hIcon);
+ SetHandle(hIcon);
}
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
protected override bool ReleaseHandle() {
- return User32.DestroyIcon(this.handle);
+ return User32.DestroyIcon(handle);
}
}
diff --git a/GreenshotPlugin/UnmanagedHelpers/WinMM.cs b/GreenshotPlugin/UnmanagedHelpers/WinMM.cs
index 2cdb7b71f..e5f92a222 100644
--- a/GreenshotPlugin/UnmanagedHelpers/WinMM.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/WinMM.cs
@@ -27,9 +27,9 @@ namespace GreenshotPlugin.UnmanagedHelpers {
///
public class WinMM {
[DllImport("winmm.dll", SetLastError = true)]
- public static extern bool PlaySound(byte[] ptrToSound, System.UIntPtr hmod, uint fdwSound);
+ public static extern bool PlaySound(byte[] ptrToSound, UIntPtr hmod, uint fdwSound);
[DllImport("winmm.dll", SetLastError = true)]
- public static extern bool PlaySound(IntPtr ptrToSound, System.UIntPtr hmod, uint fdwSound);
+ public static extern bool PlaySound(IntPtr ptrToSound, UIntPtr hmod, uint fdwSound);
}
}