aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Point.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Point.cs')
-rw-r--r--src/Point.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Point.cs b/src/Point.cs
index 369cf01d..76beaa99 100644
--- a/src/Point.cs
+++ b/src/Point.cs
@@ -130,7 +130,7 @@ namespace Crow
public override string ToString()
{
- return string.Format("({0},{1})", X, Y);
+ return string.Format("({0};{1})", X, Y);
}
public override bool Equals(object obj)
@@ -141,6 +141,19 @@ namespace Crow
{
return base.GetHashCode();
}
+ public static Point Parse(string s)
+ {
+ if (string.IsNullOrEmpty (s))
+ return default(Point);
+ string[] d = s.Trim().Split(';');
+ if (d.Length == 2)
+ return new Point (int.Parse (d [0]), int.Parse (d [1]));
+ else if (d.Length == 1) {
+ int tmp = int.Parse (d [0]);
+ return new Point (tmp, tmp);
+ }
+ throw new Exception ("Crow.Point Parsing Error: " + s);
+ }
}
}