diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-03-21 07:39:28 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-04-14 12:44:46 +0200 |
| commit | 0490aefbd71436f575187602355cfcda48a92063 (patch) | |
| tree | 63e31069e1aa3faf9cbca41ada94b7efbef1a7fa | |
| parent | 45fb721a432caec62068994ee9a56a4b843bcc03 (diff) | |
code clean
| -rw-r--r-- | src/Colors.cs | 19 | ||||
| -rw-r--r-- | src/GraphicObjects/GenericStack.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/PrivateContainer.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/TabView.cs | 1 | ||||
| -rw-r--r-- | src/Input/KeyboardKeyEventArgs.cs | 1 | ||||
| -rw-r--r-- | src/Rectangle.cs | 20 | ||||
| -rw-r--r-- | src/Size.cs | 19 | ||||
| -rw-r--r-- | src/SolidColor.cs | 4 |
9 files changed, 60 insertions, 7 deletions
diff --git a/src/Colors.cs b/src/Colors.cs index 4cb8cd5c..269d7ae6 100644 --- a/src/Colors.cs +++ b/src/Colors.cs @@ -1028,6 +1028,25 @@ namespace Crow } #endregion + public override int GetHashCode () + { + unchecked // Overflow is fine, just wrap + { + int hash = 17; + // Suitable nullity checks etc, of course :) + hash = hash * 23 + A.GetHashCode(); + hash = hash * 23 + R.GetHashCode(); + hash = hash * 23 + G.GetHashCode(); + hash = hash * 23 + B.GetHashCode(); + return hash; + } + } + public override bool Equals (object obj) + { + return (obj == null || obj.GetType() != typeof(Color)) ? + false : + this == (Color)obj; + } public override string ToString() { if (!string.IsNullOrEmpty(Name)) diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index 6dec8453..362143fa 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -218,7 +218,6 @@ namespace Crow { base.OnChildLayoutChanges (sender, arg); - GraphicObject g = sender as GraphicObject; switch (arg.LayoutType) { case LayoutingType.Width: if (Orientation == Orientation.Horizontal) { diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index a6ed7807..81ec72a6 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -1225,7 +1225,6 @@ namespace Crow { if (!reader.HasAttributes) return; - Type thisType = this.GetType (); string stylePath = reader.GetAttribute ("Style"); diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index ddabc7e0..a399567c 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -138,7 +138,6 @@ namespace Crow } public virtual void OnChildLayoutChanges (object sender, LayoutingEventArgs arg) { - GraphicObject g = sender as GraphicObject; switch (arg.LayoutType) { case LayoutingType.X: break; diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs index 2700043a..65657f38 100644 --- a/src/GraphicObjects/TabView.cs +++ b/src/GraphicObjects/TabView.cs @@ -116,7 +116,6 @@ namespace Crow } public override void RemoveChild (GraphicObject child) { - int idx = Children.IndexOf (child); base.RemoveChild (child); if (selectedTab > Children.Count - 1) SelectedTab--; diff --git a/src/Input/KeyboardKeyEventArgs.cs b/src/Input/KeyboardKeyEventArgs.cs index bfe0debb..f9307ffc 100644 --- a/src/Input/KeyboardKeyEventArgs.cs +++ b/src/Input/KeyboardKeyEventArgs.cs @@ -88,7 +88,6 @@ namespace Crow /// <summary> /// Gets the scancode which generated this event. /// </summary> - [CLSCompliant(false)] public uint ScanCode { get { return (uint)Key; } diff --git a/src/Rectangle.cs b/src/Rectangle.cs index ce1ed39c..e9445224 100644 --- a/src/Rectangle.cs +++ b/src/Rectangle.cs @@ -247,6 +247,24 @@ namespace Crow int.Parse(d[2]), int.Parse(d[3])); } + public override int GetHashCode () + { + unchecked // Overflow is fine, just wrap + { + int hash = 17; + // Suitable nullity checks etc, of course :) + hash = hash * 23 + _x.GetHashCode(); + hash = hash * 23 + _y.GetHashCode(); + hash = hash * 23 + _width.GetHashCode(); + hash = hash * 23 + _height.GetHashCode(); + return hash; + } + } + public override bool Equals (object obj) + { + return (obj == null || obj.GetType() != typeof(Rectangle)) ? + false : + this == (Rectangle)obj; + } } - } diff --git a/src/Size.cs b/src/Size.cs index c9d4427b..21ddb539 100644 --- a/src/Size.cs +++ b/src/Size.cs @@ -129,7 +129,24 @@ namespace Crow return new Size(s.Width + i, s.Height + i); } #endregion - + + public override int GetHashCode () + { + unchecked // Overflow is fine, just wrap + { + int hash = 17; + // Suitable nullity checks etc, of course :) + hash = hash * 23 + _width.GetHashCode(); + hash = hash * 23 + _height.GetHashCode(); + return hash; + } + } + public override bool Equals (object obj) + { + return (obj == null || obj.GetType() != typeof(Size)) ? + false : + this == (Size)obj; + } public override string ToString() { return string.Format("{0},{1}", Width, Height); diff --git a/src/SolidColor.cs b/src/SolidColor.cs index 7a1178cc..2b6f7e71 100644 --- a/src/SolidColor.cs +++ b/src/SolidColor.cs @@ -50,6 +50,10 @@ namespace Crow return left.color == right.color ? false : true; } + public override int GetHashCode () + { + return color.GetHashCode(); + } public override bool Equals (object obj) { if (obj is Crow.Color) |