changeset 10:19bdbb80999c

Closes #47 - Remove magic numbers * Replace "magic number" -1s in WinForms with WarFoundryCore.INFINITY Also: * Code cleanup to remove warnings * Code cleanup to replace space indentation with tabs
author IBBoard <dev@ibboard.co.uk>
date Tue, 19 May 2009 18:51:32 +0000
parents ffb49ec86df7
children 98a4216fd0ba
files FrmArmyTree.cs FrmDebugOutput.cs FrmEditUnitEquipment.cs FrmMain.cs FrmNewUnitEquipment.cs FrmReplaceUnitEquipment.cs FrmSelectSystem.cs FrmUnit.cs IBBoard.WarFoundry.GUI.WinForms.csproj Util/UnitEquipmentChoice.cs WarFoundry.exe.log4net
diffstat 11 files changed, 659 insertions(+), 655 deletions(-) [+]
line wrap: on
line diff
--- a/FrmArmyTree.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmArmyTree.cs	Tue May 19 18:51:32 2009 +0000
@@ -34,11 +34,11 @@
 		private ObjectAddDelegate UnitAddedMethod;
 		private ObjectRemoveDelegate UnitRemovedMethod;
 		private StringValChangedDelegate UnitNameChangedMethod, ArmyNameChangedMethod, TreeNameChangedMethod;
-        private CommandStack commandStack;
+		private CommandStack commandStack;
 
 		public FrmArmyTree(CommandStack cmdStack)
 		{
-            commandStack = cmdStack;
+			commandStack = cmdStack;
 			InitializeComponent();
 			UnitAddedMethod = new ObjectAddDelegate(AddUnit);
 			UnitRemovedMethod = new ObjectRemoveDelegate(RemoveUnit);
@@ -161,7 +161,7 @@
 				for (int i = 0; i<cats.Length; i++)
 				{
 					units = army.GetUnits(cats[i]);
-                    cats[i].NameChanged += TreeNameChangedMethod;
+					cats[i].NameChanged += TreeNameChangedMethod;
 					TreeNode[] unitNodes = new TreeNode[units.Length];
 					TreeNode temp;
 
@@ -185,7 +185,7 @@
 
 		private TreeNode createTreeNode(Unit unit)
 		{
-            TreeNode temp = new TreeNode(unit.Name);
+			TreeNode temp = new TreeNode(unit.Name);
 			temp.Tag = unit;
 			unit.NameChanged+= UnitNameChangedMethod;
 			htNodes[unit.ID] = temp;
@@ -203,17 +203,17 @@
 
 		public void FrmArmyTree_ArmyChanged(Army oldArmy, Army newArmy)
 		{
-            if (oldArmy != null)
-            {
-                oldArmy.UnitAdded -= UnitAddedMethod;
-                oldArmy.UnitRemoved -= UnitRemovedMethod;
-            }
+			if (oldArmy != null)
+			{
+				oldArmy.UnitAdded -= UnitAddedMethod;
+				oldArmy.UnitRemoved -= UnitRemovedMethod;
+			}
 
-            if (newArmy != null)
+			if (newArmy != null)
 			{
-                newArmy.UnitAdded += UnitAddedMethod;
-                newArmy.UnitRemoved += UnitRemovedMethod;
-                SetArmy(newArmy);
+				newArmy.UnitAdded += UnitAddedMethod;
+				newArmy.UnitRemoved += UnitRemovedMethod;
+				SetArmy(newArmy);
 			}
 			else
 			{
@@ -345,7 +345,7 @@
 				
 				if (node!=null)
 				{
-                    node.Text = unit.Name;
+					node.Text = unit.Name;
 				}
 			}
 		}
@@ -359,7 +359,7 @@
 				
 				if (node!=null)
 				{
-                    node.Text = army.Name;
+					node.Text = army.Name;
 				}
 			}
 		}
@@ -379,7 +379,7 @@
 
 			if (node!=null)
 			{
-                node.Text = obj.Name;
+				node.Text = obj.Name;
 			}
 		}
 	}
--- a/FrmDebugOutput.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmDebugOutput.cs	Tue May 19 18:51:32 2009 +0000
@@ -26,13 +26,12 @@
 		/// Required designer variable.
 		/// </summary>
 		private System.ComponentModel.Container components = null;
-		private Logger logger;
 		private System.Windows.Forms.ContextMenu contextMenu;
 		private System.Windows.Forms.MenuItem miCopy;
 		private System.Windows.Forms.TextBox txtDetail;
 		private System.Windows.Forms.Splitter splitter1;
 		private System.Windows.Forms.Panel panel1;
-		private int MAX_LIST_LENGTH = 50;
+		//private int MAX_LIST_LENGTH = 50;
 
 		public FrmDebugOutput()
 		{
@@ -70,7 +69,7 @@
 
 			this.Name = "DebugOutputForm";
 
-			cmbDebugLevel.SelectedItem = logger.LogLevel;
+			//cmbDebugLevel.SelectedItem = logger.LogLevel;
 
 			Translation.Translate(this, true);
 
--- a/FrmEditUnitEquipment.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmEditUnitEquipment.cs	Tue May 19 18:51:32 2009 +0000
@@ -41,13 +41,13 @@
 			this.unit = unit;
 			this.equipItem = equipItem;
 			InitializeComponent();
-            this.Text = equipItem.Name + " for " + unit.Name;
-            equipAmount = unit.GetEquipmentAmount(equipItem);
+			this.Text = equipItem.Name + " for " + unit.Name;
+			equipAmount = unit.GetEquipmentAmount(equipItem);
 
-            if (equipItem.IsRatioLimit)
+			if (equipItem.IsRatioLimit)
 			{
-                numEquipAmount.Minimum = (decimal)Math.Round(equipItem.MinNumber * 100.0, 2);
-                numEquipAmount.Maximum = (decimal)Math.Round(equipItem.MaxNumber * 100.0, 2);
+				numEquipAmount.Minimum = (decimal)Math.Round(equipItem.MinNumber * 100.0, 2);
+				numEquipAmount.Maximum = (decimal)Math.Round(equipItem.MaxNumber * 100.0, 2);
 				numEquipAmount.Value = (decimal)Math.Round(equipAmount * 100, 2);
 				cbEquipAll.Enabled = false;
 				lblPercent.Visible = true;
@@ -55,12 +55,12 @@
 			}
 			else
 			{
-                numEquipAmount.Minimum = (decimal)(equipItem.MinNumber != -1 ? equipItem.MinNumber : unit.Size);
-                numEquipAmount.Maximum = (decimal)(equipItem.MaxNumber != -1 ? equipItem.MaxNumber : unit.Size);
-				numEquipAmount.Value = (decimal)(equipAmount == -1 ? unit.Size : equipAmount);
-				cbEquipAll.Checked = (equipAmount == -1);
-                cbEquipAll.Enabled = (equipItem.MaxNumber == -1 && equipItem.MinNumber != -1);
-                numEquipAmount.Enabled = !cbEquipAll.Checked && equipItem.MinNumber != -1;
+				numEquipAmount.Minimum = (decimal)(equipItem.MinNumber != WarFoundryCore.INFINITY ? equipItem.MinNumber : unit.Size);
+				numEquipAmount.Maximum = (decimal)(equipItem.MaxNumber != WarFoundryCore.INFINITY ? equipItem.MaxNumber : unit.Size);
+				numEquipAmount.Value = (decimal)(equipAmount == WarFoundryCore.INFINITY ? unit.Size : equipAmount);
+				cbEquipAll.Checked = (equipAmount == WarFoundryCore.INFINITY);
+				cbEquipAll.Enabled = (equipItem.MaxNumber == WarFoundryCore.INFINITY && equipItem.MinNumber != WarFoundryCore.INFINITY);
+				numEquipAmount.Enabled = !cbEquipAll.Checked && equipItem.MinNumber != WarFoundryCore.INFINITY;
 				numEquipAmount.Width = 144;
 			}
 
@@ -188,7 +188,7 @@
 
 		private bool setValue()
 		{
-            if ((!numEquipAmount.Enabled || numEquipAmount.Value == 0) && !cbEquipAll.Checked && unit.GetEquipmentAmount(equipItem) != 0)
+			if ((!numEquipAmount.Enabled || numEquipAmount.Value == 0) && !cbEquipAll.Checked && unit.GetEquipmentAmount(equipItem) != 0)
 			{
 				if (equipItem.IsRequired)
 				{
@@ -208,20 +208,20 @@
 
 			if (cbEquipAll.Checked)
 			{
-				if (equipAmount!=-1)
+				if (equipAmount != WarFoundryCore.INFINITY)
 				{
-                    commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, -1));
+					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, WarFoundryCore.INFINITY));
 				}
 			}
 			else if (numEquipAmount.Value != (decimal)equipAmount)
 			{
-                if (equipItem.IsRatioLimit)
+				if (equipItem.IsRatioLimit)
 				{
-                    commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, ((double)numEquipAmount.Value / 100.0)));
+					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, ((double)numEquipAmount.Value / 100.0)));
 				}
 				else
 				{
-                    commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value));
+					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value));
 				}
 			}
 
@@ -235,7 +235,7 @@
 
 		private void cbEquipAll_CheckedChanged(object sender, System.EventArgs e)
 		{
-            numEquipAmount.Enabled = !cbEquipAll.Checked && equipItem.MinNumber != -1;
+			numEquipAmount.Enabled = !cbEquipAll.Checked && equipItem.MinNumber != WarFoundryCore.INFINITY;
 			setOkayButton();
 		}
 
--- a/FrmMain.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmMain.cs	Tue May 19 18:51:32 2009 +0000
@@ -1,7 +1,7 @@
-// This file (FrmMain.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard.
-//
-// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
-
+// This file (FrmMain.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard.
+//
+// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
+
 using System;
 using System.Drawing;
 using System.Drawing.Drawing2D;
@@ -9,23 +9,23 @@
 using System.ComponentModel;
 using System.Windows.Forms;
 using System.Data;
-using System.IO;
-using System.Threading;
-using log4net;
-using IBBoard;
+using System.IO;
+using System.Threading;
+using log4net;
+using IBBoard;
 using IBBoard.CustomMath;
-using IBBoard.Commands;
-using IBBoard.IO;
-using IBBoard.Lang;
-using IBBoard.Log4Net;
-using IBBoard.Windows.Forms;
-using IBBoard.Windows.Forms.I18N;
-using IBBoard.Xml;
-using IBBoard.WarFoundry.API;
-using IBBoard.WarFoundry.API.Commands;
-using IBBoard.WarFoundry.API.Objects;
-using IBBoard.WarFoundry.API.Savers;
-using IBBoard.WarFoundry.API.Factories;
+using IBBoard.Commands;
+using IBBoard.IO;
+using IBBoard.Lang;
+using IBBoard.Log4Net;
+using IBBoard.Windows.Forms;
+using IBBoard.Windows.Forms.I18N;
+using IBBoard.Xml;
+using IBBoard.WarFoundry.API;
+using IBBoard.WarFoundry.API.Commands;
+using IBBoard.WarFoundry.API.Objects;
+using IBBoard.WarFoundry.API.Savers;
+using IBBoard.WarFoundry.API.Factories;
 using IBBoard.WarFoundry.API.Factories.Xml;
 
 namespace IBBoard.WarFoundry
@@ -35,11 +35,11 @@
 	/// </summary>
 	public class FrmMain : System.Windows.Forms.Form
 	{
-		private static readonly string AppTitle = "WarFoundry";
-        const string DefaultDataDir = "data";
-
-        private Preferences preferences;
-        protected readonly ILog logger = LogManager.GetLogger(typeof(FrmMain));
+		private static readonly string AppTitle = "WarFoundry";
+        const string DefaultDataDir = "data";
+
+		private Preferences preferences;
+		protected readonly ILog logger = LogManager.GetLogger(typeof(FrmMain));
 
 		private CommandStack commandStack;
 		private ToolBarButton[] categoryButtons;
@@ -50,83 +50,83 @@
 		//public FailedUnitRequirementDelegate FailedUnitRequirementMethod;
 
 		private FrmArmyTree armyTree;
-		private FrmDebugOutput debugWindow;
-        private string loadedFilePath;
-
-        private System.ComponentModel.IContainer components;
+		private FrmDebugOutput debugWindow;
+		private string loadedFilePath;
+
+		private System.ComponentModel.IContainer components;
 		private System.Windows.Forms.ToolBar toolBar;
 		private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy;
 		private System.Windows.Forms.ImageList buttonIcons;
 		private IBBoard.Windows.Forms.IBBToolBarButton bttnSaveArmy;
 		private System.Windows.Forms.OpenFileDialog openArmyDialog;
-		private System.Windows.Forms.SaveFileDialog saveArmyDialog;
-        private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy;
-        private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1;
-        private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo;
-        private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo;
-        private System.Windows.Forms.MainMenu mainMenu;
-        private IBBoard.Windows.Forms.IBBMenuItem menuFile;
+		private System.Windows.Forms.SaveFileDialog saveArmyDialog;
+		private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy;
+		private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1;
+		private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo;
+		private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo;
+		private System.Windows.Forms.MainMenu mainMenu;
+		private IBBoard.Windows.Forms.IBBMenuItem menuFile;
 		private IBBoard.Windows.Forms.IBBMenuItem miNewArmy;
-		private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy;
-        private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy;
-		private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy;
-        private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs;
-        private System.Windows.Forms.MenuItem miSep2;
-        private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem;
-        private System.Windows.Forms.MenuItem miSep1;
-        private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles;
-        private System.Windows.Forms.MenuItem miSep3;
-        private IBBoard.Windows.Forms.IBBMenuItem miExit;
+		private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy;
+		private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy;
+		private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy;
+		private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs;
+		private System.Windows.Forms.MenuItem miSep2;
+		private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem;
+		private System.Windows.Forms.MenuItem miSep1;
+		private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles;
+		private System.Windows.Forms.MenuItem miSep3;
+		private IBBoard.Windows.Forms.IBBMenuItem miExit;
 		private IBBoard.Windows.Forms.IBBMenuItem menuEdit;
-		private IBBoard.Windows.Forms.IBBMenuItem miUndo;
-        private IBBoard.Windows.Forms.IBBMenuItem miRedo;
-        private IBBoard.Windows.Forms.IBBMenuItem menuHelp;
-        private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow;
-        private IBBoard.Windows.Forms.IBBMenuItem miAbout;
+		private IBBoard.Windows.Forms.IBBMenuItem miUndo;
+		private IBBoard.Windows.Forms.IBBMenuItem miRedo;
+		private IBBoard.Windows.Forms.IBBMenuItem menuHelp;
+		private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow;
+		private IBBoard.Windows.Forms.IBBMenuItem miAbout;
 		private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel;
 		private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel;
 		private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel;
 		private System.Windows.Forms.ContextMenu undoMenu;
-		private System.Windows.Forms.ContextMenu redoMenu;
-        private IBBoard.Windows.Forms.ColorableStatusBar statusBar;
+		private System.Windows.Forms.ContextMenu redoMenu;
+		private IBBoard.Windows.Forms.ColorableStatusBar statusBar;
 		private System.Windows.Forms.Timer statusBarTimer;
 		private System.Windows.Forms.Panel pnlRight;
 
 		public FrmMain(string[] args)
 		{
-			this.Closing+=new CancelEventHandler(FrmMain_Closing);
-            CommandStack.CommandStackUpdated += new MethodInvoker(commandStack_CommandStackUpdated);
-            LogNotifierHandler.RegisterNotifierHandler();
+			this.Closing+=new CancelEventHandler(FrmMain_Closing);
+			CommandStack.CommandStackUpdated += new MethodInvoker(commandStack_CommandStackUpdated);
+			LogNotifierHandler.RegisterNotifierHandler();
 
-			InitializeComponent();
-
-            Preferences = new Preferences("WarFoundry");
-            Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
+			InitializeComponent();
+
+			Preferences = new Preferences("WarFoundry");
+			Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
 
 			//pnlRight.Left = ClientSize.Width - pnlRight.Width - 2;
 			//pnlRight.Top = toolBar.Height + 5;
 			//pnlRight.Height = ClientRectangle.Bottom - statusBar.Height - pnlRight.Top - 3;
 
 			foreach (Control ctrl in Controls)
-			{
-                ControlTranslator.TranslateControl(ctrl);
+			{
+				ControlTranslator.TranslateControl(ctrl);
 			}
 
 			foreach(Component comp in components.Components)
-			{
-                ControlTranslator.TranslateComponent(comp);
+			{
+				ControlTranslator.TranslateComponent(comp);
 			}
 
 			foreach (IBBMenuItem mi in Menu.MenuItems)
-			{
-                ControlTranslator.TranslateComponent(mi);
-			}
-
-            ControlTranslator.TranslateComponent(openArmyDialog);
-            ControlTranslator.TranslateComponent(saveArmyDialog);
+			{
+				ControlTranslator.TranslateComponent(mi);
+			}
 
-			WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged);
-            WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged);
+			ControlTranslator.TranslateComponent(openArmyDialog);
+			ControlTranslator.TranslateComponent(saveArmyDialog);
+
+			WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged);
+			WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged);
 			UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod);
 			UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod);
 			PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod);
@@ -138,59 +138,59 @@
 			armyTree.MdiParent = this;
 			armyTree.Show();
 			armyTree.StartPosition = FormStartPosition.Manual;
-			armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10);
-            ControlTranslator.TranslateControl(armyTree);
-
-            // hack to load default files
-            WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir));
-
-            IWarFoundryFactory factory = WarFoundryFactoryFactory.GetFactoryFactory().GetFactory(typeof(WarFoundryXmlFactory));
-
-            if (factory != null && factory is WarFoundryXmlFactory)
-            {
-                WarFoundryLoader.GetDefault().RegisterFactory((WarFoundryXmlFactory)factory);
-            }
+			armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10);
+            ControlTranslator.TranslateControl(armyTree);
+
+            // hack to load default files
+            WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir));
+
+            IWarFoundryFactory factory = WarFoundryFactoryFactory.GetFactoryFactory().GetFactory(typeof(WarFoundryXmlFactory));
+
+            if (factory != null && factory is WarFoundryXmlFactory)
+            {
+                WarFoundryLoader.GetDefault().RegisterFactory((WarFoundryXmlFactory)factory);
+            }
 
-            /*
-            if (args.Length == 1)
-			{
-				logger.Debug("Attempting to load from file");				
-				FileInfo file = new FileInfo(args[0]);
-				
-				try
-				{
-					if (file.Extension.Equals("."+Factory.GetArmyFileExtension()))
-					{
-						WarFoundryCore.CurrentArmy = Factory.CreateArmyFromFile(file);
-						logger.InfoFormat("Loaded army from {0}", file.FullName);
-					}
-					else if (file.Extension.Equals("."+Factory.GetSystemFileExtension()))
-					{
-						WarFoundryCore.CurrentGameSystem = Factory.CreateGameSystemFromFile(file);
-						logger.InfoFormat("Loaded game system from {0}", file.FullName);
-					}
-				}
-				catch (InvalidFileException ex)
-				{
-					MessageBox.Show(Translation.GetTranslation("InvalidFileLoadError", "The file loaded ({0}) was not a valid WarFoundry file", file.FullName), Translation.GetTranslation("InvalidFileLoadTitle", "Invalid data file", null), MessageBoxButtons.OK, MessageBoxIcon.Error);
-					logger.Error(ex);
-				}
-			}
-			else
-			{
-				string gameSystemID = Preferences.GetStringProperty("currSystem");
-
-				if (gameSystemID!=null && !"".Equals(gameSystemID))
-				{
-					logger.Debug("Attempting to load current game system from properties");
-					GameSystem sys = Factory.GetGameSystem(gameSystemID);
-					
-					if (sys!=null)
-					{
-						WarFoundryCore.CurrentGameSystem = sys;
-						logger.InfoFormat("Loaded game system {0} from properties", gameSystemID);
-					}
-				}
+			/*
+			if (args.Length == 1)
+			{
+				logger.Debug("Attempting to load from file");				
+				FileInfo file = new FileInfo(args[0]);
+				
+				try
+				{
+					if (file.Extension.Equals("."+Factory.GetArmyFileExtension()))
+					{
+						WarFoundryCore.CurrentArmy = Factory.CreateArmyFromFile(file);
+						logger.InfoFormat("Loaded army from {0}", file.FullName);
+					}
+					else if (file.Extension.Equals("."+Factory.GetSystemFileExtension()))
+					{
+						WarFoundryCore.CurrentGameSystem = Factory.CreateGameSystemFromFile(file);
+						logger.InfoFormat("Loaded game system from {0}", file.FullName);
+					}
+				}
+				catch (InvalidFileException ex)
+				{
+					MessageBox.Show(Translation.GetTranslation("InvalidFileLoadError", "The file loaded ({0}) was not a valid WarFoundry file", file.FullName), Translation.GetTranslation("InvalidFileLoadTitle", "Invalid data file", null), MessageBoxButtons.OK, MessageBoxIcon.Error);
+					logger.Error(ex);
+				}
+			}
+			else
+			{
+				string gameSystemID = Preferences.GetStringProperty("currSystem");
+
+				if (gameSystemID!=null && !"".Equals(gameSystemID))
+				{
+					logger.Debug("Attempting to load current game system from properties");
+					GameSystem sys = Factory.GetGameSystem(gameSystemID);
+					
+					if (sys!=null)
+					{
+						WarFoundryCore.CurrentGameSystem = sys;
+						logger.InfoFormat("Loaded game system {0} from properties", gameSystemID);
+					}
+				}
 			}*/
 		}
 
@@ -201,14 +201,14 @@
 
 		public static String ArmiesPath
 		{
-			get { return Constants.UserDataPath+Constants.DirectoryChar+"armies"; }
-        }
-
-        public Preferences Preferences
-        {
-            get { return preferences; }
-            set { preferences = value; }
-        }
+			get { return Constants.UserDataPath+Constants.DirectoryChar+"armies"; }
+		}
+
+		public Preferences Preferences
+		{
+			get { return preferences; }
+			set { preferences = value; }
+		}
 
 		public CommandStack CommandStack
 		{
@@ -244,343 +244,343 @@
 		/// the contents of this method with the code editor.
 		/// </summary>
 		private void InitializeComponent()
-		{
-            this.components = new System.ComponentModel.Container();
-            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
-            this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
-            this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
-            this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
-            this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
-            this.toolBar = new System.Windows.Forms.ToolBar();
-            this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
-            this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
-            this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
-            this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton();
-            this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton();
-            this.undoMenu = new System.Windows.Forms.ContextMenu();
-            this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton();
-            this.redoMenu = new System.Windows.Forms.ContextMenu();
-            this.buttonIcons = new System.Windows.Forms.ImageList(this.components);
-            this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
-            this.menuFile = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miNewArmy = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miOpenArmy = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miSep1 = new System.Windows.Forms.MenuItem();
-            this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miSep2 = new System.Windows.Forms.MenuItem();
-            this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miSep3 = new System.Windows.Forms.MenuItem();
-            this.miExit = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem();
-            this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
-            this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
-            this.pnlRight = new System.Windows.Forms.Panel();
-            this.statusBarTimer = new System.Windows.Forms.Timer(this.components);
-            ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit();
-            this.SuspendLayout();
-            // 
-            // statusBar
-            // 
-            this.statusBar.Location = new System.Drawing.Point(0, 548);
-            this.statusBar.Name = "statusBar";
-            this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
-            this.sbMainPanel,
-            this.sbErrorPanel,
-            this.sbPointsPanel});
-            this.statusBar.ShowPanels = true;
-            this.statusBar.Size = new System.Drawing.Size(792, 22);
-            this.statusBar.TabIndex = 1;
-            this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick);
-            this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem);
-            // 
-            // sbMainPanel
-            // 
-            this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
-            this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
-            this.sbMainPanel.Name = "sbMainPanel";
-            this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
-            this.sbMainPanel.Width = 475;
-            // 
-            // sbErrorPanel
-            // 
-            this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
-            this.sbErrorPanel.Name = "sbErrorPanel";
-            this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
-            this.sbErrorPanel.Width = 150;
-            // 
-            // sbPointsPanel
-            // 
-            this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
-            this.sbPointsPanel.Name = "sbPointsPanel";
-            this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
-            this.sbPointsPanel.ToolTipText = "Current Points Total";
-            this.sbPointsPanel.Width = 150;
-            // 
-            // toolBar
-            // 
-            this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
-            this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
-            this.bttnNewArmy,
-            this.bttnOpenArmy,
-            this.bttnSaveArmy,
-            this.bttnSep1,
-            this.bttnUndo,
-            this.bttnRedo});
-            this.toolBar.ButtonSize = new System.Drawing.Size(16, 16);
-            this.toolBar.DropDownArrows = true;
-            this.toolBar.ImageList = this.buttonIcons;
-            this.toolBar.Location = new System.Drawing.Point(0, 0);
-            this.toolBar.Name = "toolBar";
-            this.toolBar.ShowToolTips = true;
-            this.toolBar.Size = new System.Drawing.Size(792, 28);
-            this.toolBar.TabIndex = 2;
-            this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
-            // 
-            // bttnNewArmy
-            // 
-            this.bttnNewArmy.Enabled = false;
-            this.bttnNewArmy.ImageIndex = 0;
-            this.bttnNewArmy.Name = "bttnNewArmy";
-            // 
-            // bttnOpenArmy
-            // 
-            this.bttnOpenArmy.ImageIndex = 2;
-            this.bttnOpenArmy.Name = "bttnOpenArmy";
-            // 
-            // bttnSaveArmy
-            // 
-            this.bttnSaveArmy.Enabled = false;
-            this.bttnSaveArmy.ImageIndex = 1;
-            this.bttnSaveArmy.Name = "bttnSaveArmy";
-            // 
-            // bttnSep1
-            // 
-            this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
-            // 
-            // bttnUndo
-            // 
-            this.bttnUndo.DropDownMenu = this.undoMenu;
-            this.bttnUndo.Enabled = false;
-            this.bttnUndo.ImageIndex = 3;
-            this.bttnUndo.Name = "bttnUndo";
-            this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
-            // 
-            // bttnRedo
-            // 
-            this.bttnRedo.DropDownMenu = this.redoMenu;
-            this.bttnRedo.Enabled = false;
-            this.bttnRedo.ImageIndex = 4;
-            this.bttnRedo.Name = "bttnRedo";
-            this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
-            // 
-            // buttonIcons
-            // 
-            this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream")));
-            this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent;
-            this.buttonIcons.Images.SetKeyName(0, "");
-            this.buttonIcons.Images.SetKeyName(1, "");
-            this.buttonIcons.Images.SetKeyName(2, "");
-            this.buttonIcons.Images.SetKeyName(3, "");
-            this.buttonIcons.Images.SetKeyName(4, "");
-            this.buttonIcons.Images.SetKeyName(5, "");
-            this.buttonIcons.Images.SetKeyName(6, "");
-            // 
-            // mainMenu
-            // 
-            this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.menuFile,
-            this.menuEdit,
-            this.menuHelp});
-            // 
-            // menuFile
-            // 
-            this.menuFile.Index = 0;
-            this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.miNewArmy,
-            this.miOpenArmy,
-            this.miSaveArmy,
-            this.miSaveArmyAs,
-            this.miCloseArmy,
-            this.miSep1,
-            this.miChangeSystem,
-            this.miSep2,
-            this.miReloadFiles,
-            this.miSep3,
-            this.miExit});
-            this.menuFile.Text = "&file";
-            this.menuFile.Name = "menuFile";
-            // 
-            // miNewArmy
-            // 
-            this.miNewArmy.Index = 0;
-            this.miNewArmy.Text = "&new army";
-            this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
-            this.miNewArmy.Name = "miNewArmy";
-            // 
-            // miOpenArmy
-            // 
-            this.miOpenArmy.Index = 1;
-            this.miOpenArmy.Text = "&open army";
-            this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
-            this.miOpenArmy.Name = "miOpenArmy";
-            // 
-            // miSaveArmy
-            // 
-            this.miSaveArmy.Enabled = false;
-            this.miSaveArmy.Index = 2;
-            this.miSaveArmy.Text = "&save army";
-            this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
-            this.miSaveArmy.Name = "miSaveArmy";
-            // 
-            // miSaveArmyAs
-            // 
-            this.miSaveArmyAs.Enabled = false;
-            this.miSaveArmyAs.Index = 3;
-            this.miSaveArmyAs.Text = "save army &as...";
-            this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click);
-            this.miSaveArmyAs.Name = "miSaveArmyAs";
-            // 
-            // miCloseArmy
-            // 
-            this.miCloseArmy.Enabled = false;
-            this.miCloseArmy.Index = 4;
-            this.miCloseArmy.Text = "&close army";
-            this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click);
-            this.miCloseArmy.Name = "miCloseArmy";
-            // 
-            // miSep1
-            // 
-            this.miSep1.Index = 5;
-            this.miSep1.Text = "-";
-            // 
-            // miChangeSystem
-            // 
-            this.miChangeSystem.Index = 6;
-            this.miChangeSystem.Text = "change &game system";
-            this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click);
-            this.miChangeSystem.Name = "miChangeSystem";
-            // 
-            // miSep2
-            // 
-            this.miSep2.Index = 7;
-            this.miSep2.Text = "-";
-            // 
-            // miReloadFiles
-            // 
-            this.miReloadFiles.Index = 8;
-            this.miReloadFiles.Text = "&reload files";
-            this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click);
-            this.miReloadFiles.Name = "miReloadFiles";
-            // 
-            // miSep3
-            // 
-            this.miSep3.Index = 9;
-            this.miSep3.Text = "-";
-            // 
-            // miExit
-            // 
-            this.miExit.Index = 10;
-            this.miExit.Text = "e&xit";
-            this.miExit.Click += new System.EventHandler(this.miExit_Click);
-            this.miExit.Name = "miExit";
-            // 
-            // menuEdit
-            // 
-            this.menuEdit.Index = 1;
-            this.menuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.miUndo,
-            this.miRedo});
-            this.menuEdit.Text = "&edit";
-            this.menuEdit.Name = "menuEdit";
-            // 
-            // miUndo
-            // 
-            this.miUndo.Enabled = false;
-            this.miUndo.Index = 0;
-            this.miUndo.Text = "&undo";
-            this.miUndo.Click += new System.EventHandler(this.miUndo_Click);
-            this.miUndo.Name = "miUndo";
-            // 
-            // miRedo
-            // 
-            this.miRedo.Enabled = false;
-            this.miRedo.Index = 1;
-            this.miRedo.Text = "&redo";
-            this.miRedo.Click += new System.EventHandler(this.miRedo_Click);
-            this.miRedo.Name = "miRedo";
-            // 
-            // menuHelp
-            // 
-            this.menuHelp.Index = 2;
-            this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
-            this.miAbout,
-            this.miDebugWindow});
-            this.menuHelp.Text = "&help";
-            this.menuHelp.Name = "menuHelp";
-            // 
-            // miAbout
-            // 
-            this.miAbout.Enabled = false;
-            this.miAbout.Index = 0;
-            this.miAbout.Text = "&about";
-            this.miAbout.Name = "miAbout";
-            // 
-            // miDebugWindow
-            // 
-            this.miDebugWindow.Index = 1;
-            this.miDebugWindow.Text = "&debug";
-            this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click);
-            this.miDebugWindow.Name = "miDebugWindow";
-            // 
-            // saveArmyDialog
-            // 
-            this.saveArmyDialog.Title = "Translatable:saveArmyDialog";
-            // 
-            // pnlRight
-            // 
-            this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                        | System.Windows.Forms.AnchorStyles.Right)));
-            this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace;
-            this.pnlRight.Location = new System.Drawing.Point(726, 30);
-            this.pnlRight.Name = "pnlRight";
-            this.pnlRight.Size = new System.Drawing.Size(64, 516);
-            this.pnlRight.TabIndex = 4;
-            this.pnlRight.Visible = false;
-            this.pnlRight.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlRight_Paint);
-            // 
-            // statusBarTimer
-            // 
-            this.statusBarTimer.Interval = 5000;
-            this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick);
-            // 
-            // FrmMain
-            // 
-            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
-            this.ClientSize = new System.Drawing.Size(792, 570);
-            this.Controls.Add(this.pnlRight);
-            this.Controls.Add(this.toolBar);
-            this.Controls.Add(this.statusBar);
-            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
-            this.IsMdiContainer = true;
-            this.Menu = this.mainMenu;
-            this.Name = "FrmMain";
-            this.Text = "WarFoundry";
-            ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit();
-            this.ResumeLayout(false);
-            this.PerformLayout();
-
+		{
+			this.components = new System.ComponentModel.Container();
+			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
+			this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
+			this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
+			this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
+			this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
+			this.toolBar = new System.Windows.Forms.ToolBar();
+			this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
+			this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
+			this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
+			this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton();
+			this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton();
+			this.undoMenu = new System.Windows.Forms.ContextMenu();
+			this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton();
+			this.redoMenu = new System.Windows.Forms.ContextMenu();
+			this.buttonIcons = new System.Windows.Forms.ImageList(this.components);
+			this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
+			this.menuFile = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miNewArmy = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miOpenArmy = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miSep1 = new System.Windows.Forms.MenuItem();
+			this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miSep2 = new System.Windows.Forms.MenuItem();
+			this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miSep3 = new System.Windows.Forms.MenuItem();
+			this.miExit = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem();
+			this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
+			this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
+			this.pnlRight = new System.Windows.Forms.Panel();
+			this.statusBarTimer = new System.Windows.Forms.Timer(this.components);
+			((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit();
+			((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit();
+			((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit();
+			this.SuspendLayout();
+			// 
+			// statusBar
+			// 
+			this.statusBar.Location = new System.Drawing.Point(0, 548);
+			this.statusBar.Name = "statusBar";
+			this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
+			this.sbMainPanel,
+			this.sbErrorPanel,
+			this.sbPointsPanel});
+			this.statusBar.ShowPanels = true;
+			this.statusBar.Size = new System.Drawing.Size(792, 22);
+			this.statusBar.TabIndex = 1;
+			this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick);
+			this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem);
+			// 
+			// sbMainPanel
+			// 
+			this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
+			this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
+			this.sbMainPanel.Name = "sbMainPanel";
+			this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
+			this.sbMainPanel.Width = 475;
+			// 
+			// sbErrorPanel
+			// 
+			this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
+			this.sbErrorPanel.Name = "sbErrorPanel";
+			this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
+			this.sbErrorPanel.Width = 150;
+			// 
+			// sbPointsPanel
+			// 
+			this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
+			this.sbPointsPanel.Name = "sbPointsPanel";
+			this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
+			this.sbPointsPanel.ToolTipText = "Current Points Total";
+			this.sbPointsPanel.Width = 150;
+			// 
+			// toolBar
+			// 
+			this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
+			this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
+			this.bttnNewArmy,
+			this.bttnOpenArmy,
+			this.bttnSaveArmy,
+			this.bttnSep1,
+			this.bttnUndo,
+			this.bttnRedo});
+			this.toolBar.ButtonSize = new System.Drawing.Size(16, 16);
+			this.toolBar.DropDownArrows = true;
+			this.toolBar.ImageList = this.buttonIcons;
+			this.toolBar.Location = new System.Drawing.Point(0, 0);
+			this.toolBar.Name = "toolBar";
+			this.toolBar.ShowToolTips = true;
+			this.toolBar.Size = new System.Drawing.Size(792, 28);
+			this.toolBar.TabIndex = 2;
+			this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
+			// 
+			// bttnNewArmy
+			// 
+			this.bttnNewArmy.Enabled = false;
+			this.bttnNewArmy.ImageIndex = 0;
+			this.bttnNewArmy.Name = "bttnNewArmy";
+			// 
+			// bttnOpenArmy
+			// 
+			this.bttnOpenArmy.ImageIndex = 2;
+			this.bttnOpenArmy.Name = "bttnOpenArmy";
+			// 
+			// bttnSaveArmy
+			// 
+			this.bttnSaveArmy.Enabled = false;
+			this.bttnSaveArmy.ImageIndex = 1;
+			this.bttnSaveArmy.Name = "bttnSaveArmy";
+			// 
+			// bttnSep1
+			// 
+			this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
+			// 
+			// bttnUndo
+			// 
+			this.bttnUndo.DropDownMenu = this.undoMenu;
+			this.bttnUndo.Enabled = false;
+			this.bttnUndo.ImageIndex = 3;
+			this.bttnUndo.Name = "bttnUndo";
+			this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
+			// 
+			// bttnRedo
+			// 
+			this.bttnRedo.DropDownMenu = this.redoMenu;
+			this.bttnRedo.Enabled = false;
+			this.bttnRedo.ImageIndex = 4;
+			this.bttnRedo.Name = "bttnRedo";
+			this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
+			// 
+			// buttonIcons
+			// 
+			this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream")));
+			this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent;
+			this.buttonIcons.Images.SetKeyName(0, "");
+			this.buttonIcons.Images.SetKeyName(1, "");
+			this.buttonIcons.Images.SetKeyName(2, "");
+			this.buttonIcons.Images.SetKeyName(3, "");
+			this.buttonIcons.Images.SetKeyName(4, "");
+			this.buttonIcons.Images.SetKeyName(5, "");
+			this.buttonIcons.Images.SetKeyName(6, "");
+			// 
+			// mainMenu
+			// 
+			this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+			this.menuFile,
+			this.menuEdit,
+			this.menuHelp});
+			// 
+			// menuFile
+			// 
+			this.menuFile.Index = 0;
+			this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+			this.miNewArmy,
+			this.miOpenArmy,
+			this.miSaveArmy,
+			this.miSaveArmyAs,
+			this.miCloseArmy,
+			this.miSep1,
+			this.miChangeSystem,
+			this.miSep2,
+			this.miReloadFiles,
+			this.miSep3,
+			this.miExit});
+			this.menuFile.Text = "&file";
+			this.menuFile.Name = "menuFile";
+			// 
+			// miNewArmy
+			// 
+			this.miNewArmy.Index = 0;
+			this.miNewArmy.Text = "&new army";
+			this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
+			this.miNewArmy.Name = "miNewArmy";
+			// 
+			// miOpenArmy
+			// 
+			this.miOpenArmy.Index = 1;
+			this.miOpenArmy.Text = "&open army";
+			this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
+			this.miOpenArmy.Name = "miOpenArmy";
+			// 
+			// miSaveArmy
+			// 
+			this.miSaveArmy.Enabled = false;
+			this.miSaveArmy.Index = 2;
+			this.miSaveArmy.Text = "&save army";
+			this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
+			this.miSaveArmy.Name = "miSaveArmy";
+			// 
+			// miSaveArmyAs
+			// 
+			this.miSaveArmyAs.Enabled = false;
+			this.miSaveArmyAs.Index = 3;
+			this.miSaveArmyAs.Text = "save army &as...";
+			this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click);
+			this.miSaveArmyAs.Name = "miSaveArmyAs";
+			// 
+			// miCloseArmy
+			// 
+			this.miCloseArmy.Enabled = false;
+			this.miCloseArmy.Index = 4;
+			this.miCloseArmy.Text = "&close army";
+			this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click);
+			this.miCloseArmy.Name = "miCloseArmy";
+			// 
+			// miSep1
+			// 
+			this.miSep1.Index = 5;
+			this.miSep1.Text = "-";
+			// 
+			// miChangeSystem
+			// 
+			this.miChangeSystem.Index = 6;
+			this.miChangeSystem.Text = "change &game system";
+			this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click);
+			this.miChangeSystem.Name = "miChangeSystem";
+			// 
+			// miSep2
+			// 
+			this.miSep2.Index = 7;
+			this.miSep2.Text = "-";
+			// 
+			// miReloadFiles
+			// 
+			this.miReloadFiles.Index = 8;
+			this.miReloadFiles.Text = "&reload files";
+			this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click);
+			this.miReloadFiles.Name = "miReloadFiles";
+			// 
+			// miSep3
+			// 
+			this.miSep3.Index = 9;
+			this.miSep3.Text = "-";
+			// 
+			// miExit
+			// 
+			this.miExit.Index = 10;
+			this.miExit.Text = "e&xit";
+			this.miExit.Click += new System.EventHandler(this.miExit_Click);
+			this.miExit.Name = "miExit";
+			// 
+			// menuEdit
+			// 
+			this.menuEdit.Index = 1;
+			this.menuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+			this.miUndo,
+			this.miRedo});
+			this.menuEdit.Text = "&edit";
+			this.menuEdit.Name = "menuEdit";
+			// 
+			// miUndo
+			// 
+			this.miUndo.Enabled = false;
+			this.miUndo.Index = 0;
+			this.miUndo.Text = "&undo";
+			this.miUndo.Click += new System.EventHandler(this.miUndo_Click);
+			this.miUndo.Name = "miUndo";
+			// 
+			// miRedo
+			// 
+			this.miRedo.Enabled = false;
+			this.miRedo.Index = 1;
+			this.miRedo.Text = "&redo";
+			this.miRedo.Click += new System.EventHandler(this.miRedo_Click);
+			this.miRedo.Name = "miRedo";
+			// 
+			// menuHelp
+			// 
+			this.menuHelp.Index = 2;
+			this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+			this.miAbout,
+			this.miDebugWindow});
+			this.menuHelp.Text = "&help";
+			this.menuHelp.Name = "menuHelp";
+			// 
+			// miAbout
+			// 
+			this.miAbout.Enabled = false;
+			this.miAbout.Index = 0;
+			this.miAbout.Text = "&about";
+			this.miAbout.Name = "miAbout";
+			// 
+			// miDebugWindow
+			// 
+			this.miDebugWindow.Index = 1;
+			this.miDebugWindow.Text = "&debug";
+			this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click);
+			this.miDebugWindow.Name = "miDebugWindow";
+			// 
+			// saveArmyDialog
+			// 
+			this.saveArmyDialog.Title = "Translatable:saveArmyDialog";
+			// 
+			// pnlRight
+			// 
+			this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+						| System.Windows.Forms.AnchorStyles.Right)));
+			this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace;
+			this.pnlRight.Location = new System.Drawing.Point(726, 30);
+			this.pnlRight.Name = "pnlRight";
+			this.pnlRight.Size = new System.Drawing.Size(64, 516);
+			this.pnlRight.TabIndex = 4;
+			this.pnlRight.Visible = false;
+			this.pnlRight.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlRight_Paint);
+			// 
+			// statusBarTimer
+			// 
+			this.statusBarTimer.Interval = 5000;
+			this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick);
+			// 
+			// FrmMain
+			// 
+			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+			this.ClientSize = new System.Drawing.Size(792, 570);
+			this.Controls.Add(this.pnlRight);
+			this.Controls.Add(this.toolBar);
+			this.Controls.Add(this.statusBar);
+			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+			this.IsMdiContainer = true;
+			this.Menu = this.mainMenu;
+			this.Name = "FrmMain";
+			this.Text = "WarFoundry";
+			((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit();
+			((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit();
+			((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit();
+			this.ResumeLayout(false);
+			this.PerformLayout();
+
 		}
 		#endregion
 
@@ -598,11 +598,11 @@
 				Application.Run(new FrmMain(args));
 			}
 			catch(Exception ex)
-			{
-                   LogManager.GetLogger(typeof(FrmMain)).Fatal(ex);
+			{
+				   LogManager.GetLogger(typeof(FrmMain)).Fatal(ex);
 				MessageBox.Show(null, "A major, unexpected and fatal error ocurred while starting the application: \r\n\r\n"+ex.Message+"\r\n\r\n"+ex.StackTrace, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
 			}
-		}
+		}
 
 		private void miExit_Click(object sender, System.EventArgs e)
 		{
@@ -622,8 +622,8 @@
 				DialogResult dr = newArmy.ShowDialog();
 
 				if (dr == DialogResult.OK)
-				{
-                    CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize);
+				{
+					CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize);
 				}
 			}
 		}
@@ -651,7 +651,7 @@
 
 				if (dr == DialogResult.OK)
 				{
-                    /*
+					/*
 					try
 					{
 						CurrentArmy = Factory.LoadArmy(openArmyDialog.FileName);
@@ -663,8 +663,8 @@
 						MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid data file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
 						return false;
 					}
-                     * */
-                    return false;
+					 * */
+					return false;
 				}
 				else
 				{
@@ -688,8 +688,8 @@
 					DialogResult dr = MessageBox.Show(this, "The army \""+CurrentArmy.Name+"\" has been modified.\r\nSave changes before closing army?", "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3);
 
 					if (dr == DialogResult.Yes)
-					{
-                        canClose = SaveCurrentArmy();
+					{
+						canClose = SaveCurrentArmy();
 					}
 					else if (dr == DialogResult.No)
 					{
@@ -739,32 +739,32 @@
 		}
 
 		private bool SaveCurrentArmy()
-		{
-            bool saved = false;
-
-            if (loadedFilePath != null || PromptForFilePath())
-            {
-                saved = SaveCurrentArmyToFile();
-            }
-
-            return saved;
-		}
-
-        private bool SaveCurrentArmyAs()
-        {
-            bool saved = false;
-
-            if (PromptForFilePath())
-            {
-                saved = SaveCurrentArmyToFile();
-            }
+		{
+			bool saved = false;
+
+			if (loadedFilePath != null || PromptForFilePath())
+			{
+				saved = SaveCurrentArmyToFile();
+			}
+
+			return saved;
+		}
+
+		private bool SaveCurrentArmyAs()
+		{
+			bool saved = false;
+
+			if (PromptForFilePath())
+			{
+				saved = SaveCurrentArmyToFile();
+			}
 			
-            return saved;
-        }
-
-        private bool SaveCurrentArmyToFile()
-		{
-            if (WarFoundrySaver.GetSaver().Save(CurrentArmy, loadedFilePath))
+			return saved;
+		}
+
+		private bool SaveCurrentArmyToFile()
+		{
+			if (WarFoundrySaver.GetSaver().Save(CurrentArmy, loadedFilePath))
 			{
 				miSaveArmy.Enabled = false;
 				bttnSaveArmy.Enabled = false;
@@ -772,14 +772,14 @@
 				return true;
 			}
 			else
-			{
-                loadedFilePath = null;
+			{
+				loadedFilePath = null;
 				MessageBox.Show(this, Translation.GetTranslation("SaveFailed"), Translation.GetTranslation("SaveFailedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
 				return false;
 			}
-		}
-
-        private bool PromptForFilePath()
+		}
+
+		private bool PromptForFilePath()
 		{
 			if (saveArmyDialog.Filter == "")
 			{
@@ -827,8 +827,8 @@
 				openArmy();
 			}
 			else if (e.Button == bttnSaveArmy)
-			{
-                SaveCurrentArmy();
+			{
+				SaveCurrentArmy();
 			}
 			else
 			{
@@ -839,8 +839,8 @@
 
 		private GameSystem CurrentGameSystem
 		{
-			get { return WarFoundryCore.CurrentGameSystem; }
-            set { WarFoundryCore.CurrentGameSystem = value; }
+			get { return WarFoundryCore.CurrentGameSystem; }
+			set { WarFoundryCore.CurrentGameSystem = value; }
 		}
 
 		private static Army CurrentArmy
@@ -867,9 +867,9 @@
 		}
 
 		private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem)
-		{
-            miNewArmy.Enabled = newSystem != null;
-            bttnNewArmy.Enabled = newSystem != null;
+		{
+			miNewArmy.Enabled = newSystem != null;
+			bttnNewArmy.Enabled = newSystem != null;
 			setAppTitle();
 			removeCategoryButtons();
 			addCategoryButtons();
@@ -877,14 +877,14 @@
 
 		private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy)
 		{		
-			setAppTitle();
-
-            if (oldArmy != null)
-            {
-                oldArmy.UnitAdded += UnitAddedMethod;
-                oldArmy.UnitRemoved += UnitRemovedMethod;
-                oldArmy.PointsValueChanged += PointsValueChangedMethod;
-            }
+			setAppTitle();
+
+			if (oldArmy != null)
+			{
+				oldArmy.UnitAdded += UnitAddedMethod;
+				oldArmy.UnitRemoved += UnitRemovedMethod;
+				oldArmy.PointsValueChanged += PointsValueChangedMethod;
+			}
 
 			if (CurrentArmy==null)
 			{
@@ -893,19 +893,19 @@
 				disableCategoryButtons();
 			}
 			else
-			{
-                newArmy.UnitAdded += UnitAddedMethod;
-                newArmy.UnitRemoved += UnitRemovedMethod;
-                newArmy.PointsValueChanged += PointsValueChangedMethod;
+			{
+				newArmy.UnitAdded += UnitAddedMethod;
+				newArmy.UnitRemoved += UnitRemovedMethod;
+				newArmy.PointsValueChanged += PointsValueChangedMethod;
 				//TODO: Clear all buttons
 				miSaveArmyAs.Enabled = true;
 				miCloseArmy.Enabled = true;
-				enableCategoryButtons();
-
-                if (newArmy.Race.HasCategoryOverrides())
+				enableCategoryButtons();
+
+				if (newArmy.Race.HasCategoryOverrides())
 				{
-					removeCategoryButtons();
-                    addCategoryButtons(newArmy.Race.Categories);
+					removeCategoryButtons();
+					addCategoryButtons(newArmy.Race.Categories);
 				}
 			}
 
@@ -985,8 +985,8 @@
 		}
 
 		private void miSaveArmyAs_Click(object sender, System.EventArgs e)
-		{
-            SaveCurrentArmyAs();
+		{
+			SaveCurrentArmyAs();
 		}
 
 		private void commandStack_CommandStackUpdated()
@@ -1059,9 +1059,9 @@
 			{
 				bttnUndo.ToolTipText = menuItemsUndo[0].Text;
 				undoMenu.MenuItems.AddRange(menuItemsUndo);
-			}
-
-            bool canSave = loadedFilePath != null;
+			}
+
+			bool canSave = loadedFilePath != null;
 			bttnSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave;
 			miSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave;
 		}
@@ -1094,8 +1094,8 @@
 			DialogResult dr = newUnit.ShowDialog(this);
 
 			if (dr == DialogResult.OK)
-			{
-                CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, cat, CurrentArmy);
+			{
+				CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, CurrentArmy);
 				commandStack.Execute(cmd);
 			}
 		}
--- a/FrmNewUnitEquipment.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmNewUnitEquipment.cs	Tue May 19 18:51:32 2009 +0000
@@ -192,17 +192,17 @@
 
 			if (cbEquipAll.Checked)
 			{
-                commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, -1));
+				commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, WarFoundryCore.INFINITY));
 			}
 			else
 			{
-                if (equipItem.IsRatioLimit)
+				if (equipItem.IsRatioLimit)
 				{
-                    commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value / 100.0));
+					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value / 100.0));
 				}
 				else
 				{
-                    commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value));
+					commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value));
 				}
 			}
 		}
@@ -214,7 +214,7 @@
 
 		private void cbEquipAll_CheckedChanged(object sender, System.EventArgs e)
 		{
-			numEquipAmount.Enabled = ((UnitEquipmentItem)listItems.SelectedItem).MinNumber != -1 && !cbEquipAll.Checked;
+			numEquipAmount.Enabled = ((UnitEquipmentItem)listItems.SelectedItem).MinNumber != WarFoundryCore.INFINITY && !cbEquipAll.Checked;
 			setOkayButton();
 		}
 
@@ -231,10 +231,10 @@
 				UnitEquipmentItem equipItem = (UnitEquipmentItem)listItems.SelectedItem;
 				required = equipItem.IsRequired;
 
-                if (equipItem.IsRatioLimit)
+				if (equipItem.IsRatioLimit)
 				{
-                    numEquipAmount.Minimum = (decimal)Math.Round(equipItem.MinNumber * 100.0, 2);
-                    numEquipAmount.Maximum = (decimal)Math.Round(equipItem.MaxNumber * 100.0, 2);
+					numEquipAmount.Minimum = (decimal)Math.Round(equipItem.MinNumber * 100.0, 2);
+					numEquipAmount.Maximum = (decimal)Math.Round(equipItem.MaxNumber * 100.0, 2);
 					numEquipAmount.Value = numEquipAmount.Minimum;
 					cbEquipAll.Enabled = false;
 					lblPercent.Visible = true;
@@ -242,11 +242,11 @@
 				}
 				else
 				{
-                    numEquipAmount.Minimum = (decimal)(equipItem.MinNumber != -1 ? equipItem.MinNumber : unit.Size);
-                    numEquipAmount.Maximum = (decimal)(equipItem.MaxNumber != -1 ? equipItem.MaxNumber : unit.Size);
+					numEquipAmount.Minimum = (decimal)(equipItem.MinNumber != WarFoundryCore.INFINITY ? equipItem.MinNumber : unit.Size);
+					numEquipAmount.Maximum = (decimal)(equipItem.MaxNumber != WarFoundryCore.INFINITY ? equipItem.MaxNumber : unit.Size);
 					numEquipAmount.Value = numEquipAmount.Minimum;
-                    cbEquipAll.Enabled = equipItem.MinNumber != -1;
-                    cbEquipAll.Checked = equipItem.MinNumber == -1;
+					cbEquipAll.Enabled = equipItem.MinNumber != WarFoundryCore.INFINITY;
+					cbEquipAll.Checked = equipItem.MinNumber == WarFoundryCore.INFINITY;
 					numEquipAmount.Width = 144;
 				}
 			}
--- a/FrmReplaceUnitEquipment.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmReplaceUnitEquipment.cs	Tue May 19 18:51:32 2009 +0000
@@ -194,7 +194,7 @@
 
 			if (cbEquipAll.Checked)
 			{
-                commandStack.Execute(new ReplaceUnitEquipmentCommand(unit, oldItem, equipItem, -1));
+                commandStack.Execute(new ReplaceUnitEquipmentCommand(unit, oldItem, equipItem, WarFoundryCore.INFINITY));
 			}
 			else
 			{
@@ -244,11 +244,11 @@
 				}
 				else
 				{
-                    numEquipAmount.Minimum = (decimal)(equipItem.MinNumber != -1 ? equipItem.MinNumber : unit.Size);
-                    numEquipAmount.Maximum = (decimal)(equipItem.MaxNumber != -1 ? equipItem.MaxNumber : unit.Size);
+                    numEquipAmount.Minimum = (decimal)(equipItem.MinNumber != WarFoundryCore.INFINITY ? equipItem.MinNumber : unit.Size);
+                    numEquipAmount.Maximum = (decimal)(equipItem.MaxNumber != WarFoundryCore.INFINITY ? equipItem.MaxNumber : unit.Size);
 					numEquipAmount.Value = numEquipAmount.Minimum;
-                    cbEquipAll.Enabled = (equipItem.MaxNumber == -1 && equipItem.MinNumber != -1);
-                    cbEquipAll.Checked = equipItem.MinNumber == -1;
+                    cbEquipAll.Enabled = (equipItem.MaxNumber == WarFoundryCore.INFINITY && equipItem.MinNumber != WarFoundryCore.INFINITY);
+                    cbEquipAll.Checked = equipItem.MinNumber == WarFoundryCore.INFINITY;
 					numEquipAmount.Width = 144;
 				}
 			}
--- a/FrmSelectSystem.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmSelectSystem.cs	Tue May 19 18:51:32 2009 +0000
@@ -30,8 +30,8 @@
 		private System.ComponentModel.Container components = null;
 		private IBBoard.Windows.Forms.IBBButton bttnCancel;
 		private IBBoard.Windows.Forms.IBBButton bttnSelectSystem;
+		private GameSystem selectedSystem;
 
-		private GameSystem selectedSystem;
 
         public FrmSelectSystem()
 		{
@@ -43,20 +43,8 @@
             ControlTranslator.TranslateControl(this);
 
 			lstSystems.Items.Clear();
-
             GameSystem[] systems = WarFoundryLoader.GetDefault().GetGameSystems();
-
             lstSystems.DataSource = systems;
-			
-			/*for (int i = 0; i<systems.Length; i++)
-			{
-				lstSystems.Items.Add(systems[i].Name);
-
-				/*if (systems[i].Matches(defaultSystem))
-				{
-					lstSystems.SelectedIndex = i;
-				}* /
-			}*/
 		}
 
 		/// <summary>
@@ -154,9 +142,7 @@
 
 		private void bttnSelectSystem_Click(object sender, System.EventArgs e)
 		{
-            // set the selected system
             selectedSystem = (GameSystem) lstSystems.SelectedItem;
-
             this.DialogResult = DialogResult.OK;
 			this.Close();
 		}
--- a/FrmUnit.cs	Tue May 19 11:10:07 2009 +0000
+++ b/FrmUnit.cs	Tue May 19 18:51:32 2009 +0000
@@ -25,8 +25,8 @@
 	public class FrmUnit : IBBoard.Windows.Forms.IBBForm
 	{
 		private Unit unit;
-        private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>();
-        private CommandStack commandStack;
+		private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>();
+		private CommandStack commandStack;
 		private System.Windows.Forms.DataGrid statsGrid;
 		private System.Windows.Forms.TextBox tbUnitName;
 		private System.Windows.Forms.NumericUpDown unitSize;
@@ -48,7 +48,7 @@
 		public FrmUnit(Unit toDisplay, CommandStack cmdStack)
 		{
 			unit = toDisplay;
-            commandStack = cmdStack;
+			commandStack = cmdStack;
 			//
 			// Required for Windows Form Designer support
 			//
@@ -69,48 +69,48 @@
 			else
 			{
 				unitSize.Value = unit.Size;
-				unitSize.Maximum = (unit.UnitType.MaxSize == -1 ? int.MaxValue : unit.UnitType.MaxSize);
+				unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize);
 				unitSize.Minimum = unit.UnitType.MinSize;
 			}
 
-			setStats();
-			setWeapons();
+			SetStats();
+			SetWeapons();
 		}
 
-		private void setStats()
+		private void SetStats()
 		{
-            GameSystem system = unit.Army.GameSystem;
-            SystemStats stats = system.StandardSystemStats;
+			GameSystem system = unit.Army.GameSystem;
+			SystemStats stats = system.StandardSystemStats;
 			
 			DataTable dt = new DataTable();
 			DataColumn[] dc = new DataColumn[stats.SlotCount+1];
 			dc[0] = new DataColumn("name");
 
-            DataGridTableStyle dgStyle = new DataGridTableStyle();
-            dgStyle.RowHeadersVisible = false;
+			DataGridTableStyle dgStyle = new DataGridTableStyle();
+			dgStyle.RowHeadersVisible = false;
 
-            DataGridTextBoxColumn colStyle = new DataGridTextBoxColumn();
-            colStyle.Width = statsGrid.ClientSize.Width - (stats.SlotCount * 40) - 4;
-            colStyle.MappingName = "name";
-            colStyle.HeaderText = "name";
-            colStyle.ReadOnly = true;
-            dgStyle.GridColumnStyles.Add(colStyle);
+			DataGridTextBoxColumn colStyle = new DataGridTextBoxColumn();
+			colStyle.Width = statsGrid.ClientSize.Width - (stats.SlotCount * 40) - 4;
+			colStyle.MappingName = "name";
+			colStyle.HeaderText = "name";
+			colStyle.ReadOnly = true;
+			dgStyle.GridColumnStyles.Add(colStyle);
 
-            DataColumn tempCol;
-            int i = 1;
+			DataColumn tempCol;
+			int i = 1;
 
 			foreach (StatSlot stat in stats.StatSlots)
 			{
 				tempCol = new DataColumn(stat.Name);
-                dc[i] = tempCol;
-                colStyle = new DataGridTextBoxColumn();
-                colStyle.Alignment = HorizontalAlignment.Center;
-                colStyle.Width = 40;
-                colStyle.MappingName = stat.Name;
-                colStyle.HeaderText = stat.Name;
-                colStyle.ReadOnly = true;
-                dgStyle.GridColumnStyles.Add(colStyle);
-                i++;
+				dc[i] = tempCol;
+				colStyle = new DataGridTextBoxColumn();
+				colStyle.Alignment = HorizontalAlignment.Center;
+				colStyle.Width = 40;
+				colStyle.MappingName = stat.Name;
+				colStyle.HeaderText = stat.Name;
+				colStyle.ReadOnly = true;
+				dgStyle.GridColumnStyles.Add(colStyle);
+				i++;
 			}
 
 			dt.Columns.AddRange(dc);
@@ -122,34 +122,34 @@
 			statsGrid.TableStyles.Add(dgStyle);
 		}
 
-		private void setWeapons()
+		private void SetWeapons()
 		{
 			foreach(UnitEquipmentItem item in unit.GetEquipment())
 			{
 				if (item.IsRequired)
 				{
-                    reqdList.Items.Add(GetEquipmentChoice(item));
+					reqdList.Items.Add(GetEquipmentChoice(item));
 				}
 				else
 				{
-                    optList.Items.Add(GetEquipmentChoice(item));
+					optList.Items.Add(GetEquipmentChoice(item));
 				}
 			}
 		}
 
-        private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item)
-        {
-            UnitEquipmentChoice choice = null;
-            equipmentChoices.TryGetValue(item, out choice);
+		private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item)
+		{
+			UnitEquipmentChoice choice = null;
+			equipmentChoices.TryGetValue(item, out choice);
 
-            if (choice == null)
-            {
-                choice = new UnitEquipmentChoice(Unit, item);
-                equipmentChoices[item] = choice;
-            }
+			if (choice == null)
+			{
+				choice = new UnitEquipmentChoice(Unit, item);
+				equipmentChoices[item] = choice;
+			}
 
-            return choice;
-        }
+			return choice;
+		}
 
 		/// <summary>
 		/// Clean up any resources being used.
--- a/IBBoard.WarFoundry.GUI.WinForms.csproj	Tue May 19 11:10:07 2009 +0000
+++ b/IBBoard.WarFoundry.GUI.WinForms.csproj	Tue May 19 18:51:32 2009 +0000
@@ -19,8 +19,7 @@
     <OutputType>WinExe</OutputType>
     <RootNamespace>IBBoard.WarFoundry</RootNamespace>
     <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
-    <StartupObject>
-    </StartupObject>
+    <StartupObject>IBBoard.WarFoundry.FrmMain</StartupObject>
     <FileUpgradeFlags>
     </FileUpgradeFlags>
     <UpgradeBackupLocation>
@@ -51,7 +50,7 @@
     <UseVSHostingProcess>true</UseVSHostingProcess>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <OutputPath>C:\Documents and Settings\ibboard\My Documents\Visual Studio 2005\Projects\bin\release\</OutputPath>
+    <OutputPath>C:\Documents and Settings\ibboard\My Documents\Visual Studio 2005\Projects\bin\Debug\</OutputPath>
     <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
     <BaseAddress>285212672</BaseAddress>
     <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
@@ -178,6 +177,7 @@
     </EmbeddedResource>
     <EmbeddedResource Include="FrmSelectSystem.resx">
       <DependentUpon>FrmSelectSystem.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="FrmUnit.resx">
       <DependentUpon>FrmUnit.cs</DependentUpon>
@@ -192,6 +192,9 @@
     <None Include="translations\en.translation">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="WarFoundry.exe.log4net">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
     <None Include="WarFoundry.exe.manifest" />
   </ItemGroup>
   <ItemGroup>
--- a/Util/UnitEquipmentChoice.cs	Tue May 19 11:10:07 2009 +0000
+++ b/Util/UnitEquipmentChoice.cs	Tue May 19 18:51:32 2009 +0000
@@ -17,7 +17,7 @@
     public class UnitEquipmentChoice
     {
         private Unit unit;
-        private UnitEquipmentItem item;
+		private UnitEquipmentItem item;
 
         private static Hashtable equipObjs = new Hashtable();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WarFoundry.exe.log4net	Tue May 19 18:51:32 2009 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- This section contains the log4net configuration settings -->
+<log4net>
+    <!-- Define some output appenders -->	
+    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
+        <layout type="log4net.Layout.PatternLayout">
+            <param name="ConversionPattern" value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" />
+        </layout>
+    </appender>
+    <!-- Setup the root category, add the appenders and set the default priority -->
+    <root>
+        <level value="DEBUG" />
+        <appender-ref ref="ConsoleAppender" />
+    </root>
+</log4net>
+