[gbrainy] Split Xml games classes in separate files



commit 14ab028bbed49bb802a8e99bdcd815a9c2df1fa0
Author: Jordi Mas <jmas softcatala org>
Date:   Thu Oct 21 22:31:52 2010 +0200

    Split Xml games classes in separate files

 src/Core/Main/Xml/DrawingObject.cs            |   28 +++++++
 src/Core/Main/Xml/GameXmlDefinition.cs        |  100 -------------------------
 src/Core/Main/Xml/GameXmlDefinitionVariant.cs |   70 +++++++++++++++++
 src/Core/Main/Xml/ImageDrawingObject.cs       |   32 ++++++++
 src/Core/Main/Xml/LocalizableString.cs        |   41 ++++++++++
 src/Core/Main/Xml/TextDrawingObject.cs        |   46 +++++++++++
 src/Core/Makefile.am                          |    5 +
 7 files changed, 222 insertions(+), 100 deletions(-)
---
diff --git a/src/Core/Main/Xml/DrawingObject.cs b/src/Core/Main/Xml/DrawingObject.cs
new file mode 100644
index 0000000..303fe66
--- /dev/null
+++ b/src/Core/Main/Xml/DrawingObject.cs
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2010 Jordi Mas i Hernàndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+
+namespace gbrainy.Core.Main.Xml
+{
+	public class DrawingObject
+	{
+
+	}
+}
diff --git a/src/Core/Main/Xml/GameXmlDefinition.cs b/src/Core/Main/Xml/GameXmlDefinition.cs
index e18bdc8..ffd2d5c 100644
--- a/src/Core/Main/Xml/GameXmlDefinition.cs
+++ b/src/Core/Main/Xml/GameXmlDefinition.cs
@@ -23,106 +23,6 @@ using System.Collections.Generic;
 
 namespace gbrainy.Core.Main.Xml
 {
-	public class LocalizableString
-	{
-		public string String { get; set; }
-		public string Value { get; set; }
-		public int ValueComputed { get; set; }
-		public string PluralString { get; set; }
-
-		public bool IsPlural ()
-		{
-			if (String.IsNullOrEmpty (String) == true ||
-				String.IsNullOrEmpty (PluralString) == true ||
-				String.IsNullOrEmpty (Value) == true)
-				return false;
-			else
-				return true;
-		}
-	}
-
-	public class DrawingObject
-	{
-
-	}
-
-	public class ImageDrawingObject : DrawingObject
-	{
-		public string Filename { get; set; }
-		public double X { get; set; }
-		public double Y { get; set; }
-		public double Width { get; set; }
-		public double Height { get; set; }
-	};
-
-	public class TextDrawingObject : DrawingObject
-	{
-		public enum Sizes
-		{
-			Small,
-			Medium,
-			Large,
-			XLarge,
-			XXLarge,
-		}
-
-		public string Text { get; set; }
-		public double X { get; set; }
-		public double Y { get; set; }
-		public bool Centered { get; set; }
-		public Sizes Size { get; set; }
-
-		public TextDrawingObject ()
-		{
-			Size = Sizes.Medium;
-		}
-	};
-
-	public class GameXmlDefinitionVariant
-	{
-		public LocalizableString Question { get; set; }
-		public string Tip { get; set; }
-		public LocalizableString Rationale { get; set; }
-		public string Answer { get; set; }
-		public string Variables { get; set; }
-		public GameAnswerCheckAttributes CheckAttributes { get; set; }
-		public string AnswerCheckExpression  { get; set; }
-		public string AnswerShow { get; set; }
-
-		List <DrawingObject> drawing_objects;
-
-		public DrawingObject [] DrawingObjects {
-			get {
-				if (drawing_objects == null)
-					return null;
-	
-				return drawing_objects.ToArray ();
-			}
-		}
-
-		public void AddDrawingObject (DrawingObject obj)
-		{
-			if (drawing_objects == null)
-				drawing_objects = new List <DrawingObject> ();
-
-			drawing_objects.Add (obj);
-		}
-
-		public override string ToString ()
-		{
-			StringBuilder str = new StringBuilder ();
-
-			str.AppendLine ("Question: " + Question);
-			str.AppendLine ("Tip: " + Tip);
-			str.AppendLine ("Rationale: " + Rationale);
-			str.AppendLine ("Answer: " + Answer);
-			str.AppendLine ("CheckAttributes: " + CheckAttributes);
-			str.AppendLine ("AnswerCheckExpression: " + AnswerCheckExpression);
-
-			return str.ToString ();
-		}
-	}
-
 	// Container for a game defined in an Xml file
 	public class GameXmlDefinition : GameXmlDefinitionVariant
 	{
diff --git a/src/Core/Main/Xml/GameXmlDefinitionVariant.cs b/src/Core/Main/Xml/GameXmlDefinitionVariant.cs
new file mode 100644
index 0000000..8065226
--- /dev/null
+++ b/src/Core/Main/Xml/GameXmlDefinitionVariant.cs
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Jordi Mas i Hernàndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+using System.Text;
+using System.Collections.Generic;
+
+namespace gbrainy.Core.Main.Xml
+{
+	public class GameXmlDefinitionVariant
+	{
+		public LocalizableString Question { get; set; }
+		public string Tip { get; set; }
+		public LocalizableString Rationale { get; set; }
+		public string Answer { get; set; }
+		public string Variables { get; set; }
+		public GameAnswerCheckAttributes CheckAttributes { get; set; }
+		public string AnswerCheckExpression  { get; set; }
+		public string AnswerShow { get; set; }
+
+		List <DrawingObject> drawing_objects;
+
+		public DrawingObject [] DrawingObjects {
+			get {
+				if (drawing_objects == null)
+					return null;
+	
+				return drawing_objects.ToArray ();
+			}
+		}
+
+		public void AddDrawingObject (DrawingObject obj)
+		{
+			if (drawing_objects == null)
+				drawing_objects = new List <DrawingObject> ();
+
+			drawing_objects.Add (obj);
+		}
+
+		public override string ToString ()
+		{
+			StringBuilder str = new StringBuilder ();
+
+			str.AppendLine ("Question: " + Question);
+			str.AppendLine ("Tip: " + Tip);
+			str.AppendLine ("Rationale: " + Rationale);
+			str.AppendLine ("Answer: " + Answer);
+			str.AppendLine ("CheckAttributes: " + CheckAttributes);
+			str.AppendLine ("AnswerCheckExpression: " + AnswerCheckExpression);
+
+			return str.ToString ();
+		}
+	}
+}
diff --git a/src/Core/Main/Xml/ImageDrawingObject.cs b/src/Core/Main/Xml/ImageDrawingObject.cs
new file mode 100644
index 0000000..8f4015f
--- /dev/null
+++ b/src/Core/Main/Xml/ImageDrawingObject.cs
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 Jordi Mas i Hernàndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+
+namespace gbrainy.Core.Main.Xml
+{
+	public class ImageDrawingObject : DrawingObject
+	{
+		public string Filename { get; set; }
+		public double X { get; set; }
+		public double Y { get; set; }
+		public double Width { get; set; }
+		public double Height { get; set; }
+	}
+}
diff --git a/src/Core/Main/Xml/LocalizableString.cs b/src/Core/Main/Xml/LocalizableString.cs
new file mode 100644
index 0000000..009ac97
--- /dev/null
+++ b/src/Core/Main/Xml/LocalizableString.cs
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Jordi Mas i Hernàndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+
+namespace gbrainy.Core.Main.Xml
+{
+	public class LocalizableString
+	{
+		public string String { get; set; }
+		public string Value { get; set; }
+		public int ValueComputed { get; set; }
+		public string PluralString { get; set; }
+
+		public bool IsPlural ()
+		{
+			if (String.IsNullOrEmpty (String) == true ||
+				String.IsNullOrEmpty (PluralString) == true ||
+				String.IsNullOrEmpty (Value) == true)
+				return false;
+			else
+				return true;
+		}
+	}
+}
diff --git a/src/Core/Main/Xml/TextDrawingObject.cs b/src/Core/Main/Xml/TextDrawingObject.cs
new file mode 100644
index 0000000..bbf5a13
--- /dev/null
+++ b/src/Core/Main/Xml/TextDrawingObject.cs
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Jordi Mas i Hernàndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+
+namespace gbrainy.Core.Main.Xml
+{
+	public class TextDrawingObject : DrawingObject
+	{
+		public enum Sizes
+		{
+			Small,
+			Medium,
+			Large,
+			XLarge,
+			XXLarge,
+		}
+
+		public string Text { get; set; }
+		public double X { get; set; }
+		public double Y { get; set; }
+		public bool Centered { get; set; }
+		public Sizes Size { get; set; }
+
+		public TextDrawingObject ()
+		{
+			Size = Sizes.Medium;
+		}
+	}
+}
diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am
index 33b3ba4..ae5108e 100644
--- a/src/Core/Makefile.am
+++ b/src/Core/Makefile.am
@@ -21,9 +21,14 @@ CSDISTFILES =  \
 		$(srcdir)/Main/GameTypes.cs		\
 		$(srcdir)/Main/GameTips.cs		\
 		$(srcdir)/Main/Xml/CodeEvaluation.cs	\
+		$(srcdir)/Main/Xml/DrawingObject.cs	\
+		$(srcdir)/Main/Xml/ImageDrawingObject.cs \
+		$(srcdir)/Main/Xml/LocalizableString.cs	\
 		$(srcdir)/Main/Xml/GameXml.cs		\
 		$(srcdir)/Main/Xml/GameXmlFactory.cs	\
 		$(srcdir)/Main/Xml/GameXmlDefinition.cs	\
+		$(srcdir)/Main/Xml/GameXmlDefinitionVariant.cs	\
+		$(srcdir)/Main/Xml/TextDrawingObject.cs	\
 		$(srcdir)/Main/Memory.cs		\
 		$(srcdir)/Main/PlayerHistory.cs		\
 		$(srcdir)/Main/PlayerPersonalRecord.cs	\



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]