aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Size.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-02 12:19:06 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-02 12:19:06 +0100
commit2b087282dd73152d21140ea7312a90e046c84f61 (patch)
tree5d03225090e39c1d14465bdbaf1882e87026402b /src/Size.cs
parent73b7c1d82226e4d10708e858a011991e3f598655 (diff)
Fix CRLF
Diffstat (limited to 'src/Size.cs')
-rw-r--r--src/Size.cs292
1 files changed, 146 insertions, 146 deletions
diff --git a/src/Size.cs b/src/Size.cs
index 6c5e79a5..c9d4427b 100644
--- a/src/Size.cs
+++ b/src/Size.cs
@@ -1,146 +1,146 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace Crow
-{
- public struct Size
- {
- public static Size Zero
- { get { return new Size(0, 0); } }
-
- int _width;
- int _height;
-
- public Size(int width, int height)
- {
- _width = width;
- _height = height;
- }
- public Size(int size)
- {
- _width = size;
- _height = size;
- }
- public int Width
- {
- get { return _width; }
- set { _width = value; }
- }
- public int Height
- {
- get { return _height; }
- set { _height = value; }
- }
-
- #region operators
- public static implicit operator Rectangle(Size s)
- {
- return new Rectangle (s);
- }
- public static implicit operator Size(int i)
- {
- return new Size(i, i);
- }
- public static implicit operator string(Size s)
- {
- return s.ToString ();
- }
- public static implicit operator Size(string s)
- {
- return string.IsNullOrEmpty (s) ? Size.Zero : Parse (s);
- }
- public static bool operator ==(Size s1, Size s2)
- {
- if (s1.Width == s2.Width && s1.Height == s2.Height)
- return true;
- else
- return false;
- }
- public static bool operator !=(Size s1, Size s2)
- {
- if (s1.Width == s2.Width && s1.Height == s2.Height)
- return false;
- else
- return true;
- }
- public static bool operator >(Size s1, Size s2)
- {
- if (s1.Width > s2.Width && s1.Height > s2.Height)
- return true;
- else
- return false;
- }
- public static bool operator >=(Size s1, Size s2)
- {
- if (s1.Width >= s2.Width && s1.Height >= s2.Height)
- return true;
- else
- return false;
- }
- public static bool operator <(Size s1, Size s2)
- {
- if (s1.Width < s2.Width)
- if (s1.Height <= s2.Height)
- return true;
- else
- return false;
- else if (s1.Width == s2.Width && s1.Height < s2.Height)
- return true;
-
- return false;
- }
- public static bool operator <(Size s, int i)
- {
- return s.Width < i && s.Height < i ? true : false;
- }
- public static bool operator <=(Size s, int i)
- {
- return s.Width <= i && s.Height <= i ? true : false;
- }
- public static bool operator <=(Size s1, Size s2)
- {
- if (s1.Width <= s2.Width && s1.Height <= s2.Height)
- return true;
- else
- return false;
- }
- public static bool operator ==(Size s, int i)
- {
- if (s.Width == i && s.Height == i)
- return true;
- else
- return false;
- }
- public static bool operator !=(Size s, int i)
- {
- if (s.Width == i && s.Height == i)
- return false;
- else
- return true;
- }
- public static Size operator +(Size s1, Size s2)
- {
- return new Size(s1.Width + s2.Width, s1.Height + s2.Height);
- }
- public static Size operator +(Size s, int i)
- {
- return new Size(s.Width + i, s.Height + i);
- }
- #endregion
-
- public override string ToString()
- {
- return string.Format("{0},{1}", Width, Height);
- }
- public static Size Parse(string s)
- {
- string[] d = s.Split(new char[] { ';' });
- return d.Length == 1 ? new Size(int.Parse(d[0])) : new Size(
- int.Parse(d[0]),
- int.Parse(d[1]));
- }
- }
-
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Crow
+{
+ public struct Size
+ {
+ public static Size Zero
+ { get { return new Size(0, 0); } }
+
+ int _width;
+ int _height;
+
+ public Size(int width, int height)
+ {
+ _width = width;
+ _height = height;
+ }
+ public Size(int size)
+ {
+ _width = size;
+ _height = size;
+ }
+ public int Width
+ {
+ get { return _width; }
+ set { _width = value; }
+ }
+ public int Height
+ {
+ get { return _height; }
+ set { _height = value; }
+ }
+
+ #region operators
+ public static implicit operator Rectangle(Size s)
+ {
+ return new Rectangle (s);
+ }
+ public static implicit operator Size(int i)
+ {
+ return new Size(i, i);
+ }
+ public static implicit operator string(Size s)
+ {
+ return s.ToString ();
+ }
+ public static implicit operator Size(string s)
+ {
+ return string.IsNullOrEmpty (s) ? Size.Zero : Parse (s);
+ }
+ public static bool operator ==(Size s1, Size s2)
+ {
+ if (s1.Width == s2.Width && s1.Height == s2.Height)
+ return true;
+ else
+ return false;
+ }
+ public static bool operator !=(Size s1, Size s2)
+ {
+ if (s1.Width == s2.Width && s1.Height == s2.Height)
+ return false;
+ else
+ return true;
+ }
+ public static bool operator >(Size s1, Size s2)
+ {
+ if (s1.Width > s2.Width && s1.Height > s2.Height)
+ return true;
+ else
+ return false;
+ }
+ public static bool operator >=(Size s1, Size s2)
+ {
+ if (s1.Width >= s2.Width && s1.Height >= s2.Height)
+ return true;
+ else
+ return false;
+ }
+ public static bool operator <(Size s1, Size s2)
+ {
+ if (s1.Width < s2.Width)
+ if (s1.Height <= s2.Height)
+ return true;
+ else
+ return false;
+ else if (s1.Width == s2.Width && s1.Height < s2.Height)
+ return true;
+
+ return false;
+ }
+ public static bool operator <(Size s, int i)
+ {
+ return s.Width < i && s.Height < i ? true : false;
+ }
+ public static bool operator <=(Size s, int i)
+ {
+ return s.Width <= i && s.Height <= i ? true : false;
+ }
+ public static bool operator <=(Size s1, Size s2)
+ {
+ if (s1.Width <= s2.Width && s1.Height <= s2.Height)
+ return true;
+ else
+ return false;
+ }
+ public static bool operator ==(Size s, int i)
+ {
+ if (s.Width == i && s.Height == i)
+ return true;
+ else
+ return false;
+ }
+ public static bool operator !=(Size s, int i)
+ {
+ if (s.Width == i && s.Height == i)
+ return false;
+ else
+ return true;
+ }
+ public static Size operator +(Size s1, Size s2)
+ {
+ return new Size(s1.Width + s2.Width, s1.Height + s2.Height);
+ }
+ public static Size operator +(Size s, int i)
+ {
+ return new Size(s.Width + i, s.Height + i);
+ }
+ #endregion
+
+ public override string ToString()
+ {
+ return string.Format("{0},{1}", Width, Height);
+ }
+ public static Size Parse(string s)
+ {
+ string[] d = s.Split(new char[] { ';' });
+ return d.Length == 1 ? new Size(int.Parse(d[0])) : new Size(
+ int.Parse(d[0]),
+ int.Parse(d[1]));
+ }
+ }
+
+}