]> O.S.I.I.S - jp/crow.git/commitdiff
code clean
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 21 Mar 2016 06:39:28 +0000 (07:39 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 14 Apr 2016 10:44:46 +0000 (12:44 +0200)
src/Colors.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/TabView.cs
src/Input/KeyboardKeyEventArgs.cs
src/Rectangle.cs
src/Size.cs
src/SolidColor.cs

index 4cb8cd5c696d257f5e703318849fef36fbfcfa5a..269d7ae6a45026574e5eeb598aa0c51bcc53e504 100644 (file)
@@ -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))
index 6dec845316d3e2f7548f9f9b963f5d102f443e5e..362143fac50e3f8bd7f8f385796a5a37a3ef9e0f 100644 (file)
@@ -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) {
index a6ed78071fe8a34f2e3454317b9e15316f2104c2..81ec72a69bd7fbae96f506dc2c1a28a7e809af14 100644 (file)
@@ -1225,7 +1225,6 @@ namespace Crow
                {
                        if (!reader.HasAttributes)
                                return;
-                       Type thisType = this.GetType ();
 
                        string stylePath = reader.GetAttribute ("Style");
 
index ddabc7e0457a45a81341d25b9d1bcb795ee9f9ce..a399567c8619bf0e2d88cff19d07942ba4c22419 100644 (file)
@@ -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;
index 2700043aa899287c89a031fb120f5a4e0550f771..65657f38ebb8429f4733521144ec0ade55b7a48d 100644 (file)
@@ -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--;
index bfe0debbf65c596ccf255d81ce518bf5bc230d05..f9307ffce3bd3d4afa6e5dea8e9c99605789aacf 100644 (file)
@@ -88,7 +88,6 @@ namespace Crow
        /// <summary>
        /// Gets the scancode which generated this event.
        /// </summary>
-       [CLSCompliant(false)]
        public uint ScanCode
        {
            get { return (uint)Key; }
index ce1ed39cce43f93ead388baad4a82cdb5deb83d8..e9445224be38d57f9f1cf6f2bfe94ad3230cbb7a 100644 (file)
@@ -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;
+               }
     }
-
 }
index c9d4427be4e792174c0d1a3ca4903ac3e3412cf9..21ddb539ab4a894dead4f360782f0c70d833699f 100644 (file)
@@ -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);
index 7a1178cc30b3881db5369afe758c67bd23c76fdd..2b6f7e71b52797545cac0ffb36ff11ace918623d 100644 (file)
@@ -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)