Experimental generic struct stuff, mostly.
Experimental generic struct stuff, mostly.

--- /dev/null
+++ b/AVOID_ConfigValue.cs
@@ -1,1 +1,28 @@
+//
+//  AVOID_ConfigValue.cs
+//
+//  Author:
+//       toadicus <>
+//
+//  Copyright (c) 2013 toadicus
+//
+//  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 3 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, see <http://www.gnu.org/licenses/>.
+using System;
 
+namespace VOID
+{
+
+}
+
+

file:a/Tools.cs -> file:b/Tools.cs
--- a/Tools.cs
+++ b/Tools.cs
@@ -27,6 +27,7 @@
 

 

 using System;

+using System.Collections.Generic;

 using UnityEngine;

 

 namespace VOID


--- a/VOIDFlightMaster.cs
+++ b/VOIDFlightMaster.cs
@@ -42,28 +42,51 @@
 	[KSPAddon(KSPAddon.Startup.Flight, false)]
 	public class VOIDFlightMaster : MonoBehaviour
 	{
-		protected List<IVOID_Module> Modules;
+		protected VOID_Core Core;
 
-		public void OnAwake()
+		public void Awake()
 		{
-			this.Modules = new List<IVOID_Module>();
+			Tools.PostDebugMessage ("VOIDLightMaster: Waking up.");
+			this.Core = (VOID_Core)VOID_Core.Instance;
+			foreach (Type T in System.Reflection.Assembly.GetExecutingAssembly().GetTypes())
+			{
+				Tools.PostDebugMessage (string.Format ("VOIDFlightMaster: Testing type {0}", T.Name));
+				if (typeof(IVOID_Module).IsAssignableFrom(T) &&
+				    !T.IsAbstract  &&
+				    !typeof(VOID_Core).IsAssignableFrom(T))
+				{
+					this.Core.LoadModule (T);
+					Tools.PostDebugMessage(string.Format("VOIDFlightMaster: Found module {0}.", T.Name));
+				}
+			}
+
+			Tools.PostDebugMessage (string.Format ("VOIDFlightMaster: Loaded {0} modules.", this.Core.Modules.Count));
+
+			this.Core.LoadConfig ();
+
+			Tools.PostDebugMessage ("VOIDFlightMaster: Awake.");
 		}
 
-		public void OnUpdate()
+		public void Update()
 		{
-			foreach (IVOID_Module module in this.Modules)
+			if (this.Core == null)
 			{
-				if (!module.guiRunning && module.toggleActive)
-				{
-					module.StartGUI();
-				}
+				return;
+			}
 
-				if (module.guiRunning && !module.toggleActive)
-				{
-					module.StopGUI();
-				}
+			this.Core.Update ();
+		}
+
+		public void FixedUpdate()
+		{
+			if (this.Core == null)
+			{
+				return;
 			}
+
+			this.Core.FixedUpdate ();
 		}
+
 //        private bool debugging = false;
 //
 //        private int window_base_id = -96518722;

file:a/VOID_Config.cs (deleted)
--- a/VOID_Config.cs
+++ /dev/null
@@ -1,509 +1,1 @@
-//
-//  VOID_Config.cs
-//
-//  Author:
-//       toadicus <>
-//
-//  Copyright (c) 2013 toadicus
-//
-//  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 3 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, see <http://www.gnu.org/licenses/>.
-using System;
-using System.Collections.Generic;
-using KSP;
-using UnityEngine;
 
-namespace VOID
-{
-	public class VOID_Config
-	{
-		/*
-		 * Static Members
-		 * */
-		// Singleton
-		private static VOID_Config _instance;
-		public static VOID_Config Instance
-		{
-			get
-			{
-				if (_instance == null)
-				{
-					_instance = new VOID_Config();
-				}
-				return _instance;
-			}
-		}
-
-		/*
-		 * Fields
-		 * */
-		protected List<IVOID_Module> Modules = new List<IVOID_Module>();
-		/*
-		 * Properties
-		 * */
-
-		/*
-		 * Methods
-		 * */
-		public void LoadConfig()
-		{
-			Tools.PostDebugMessage ("VOID: Loading settings.");
-			var config = KSP.IO.PluginConfiguration.CreateForType<VOIDFlightMaster> ();
-			config.load ();
-
-			int loadedConfigVersion = config.GetValue ("ConfigVersion", 0);
-
-			if (loadedConfigVersion < 1 || true)
-			{
-				this.load_old_settings ();
-				// this.write_settings ();
-				// TODO: Enable this when the config update works for sure.
-				// KSP.IO.File.Delete<VOID> ("VOID.cfg");
-				return;
-			}
-
-			this.main_window_pos = config.GetValue("MAIN_WINDOW_POS", main_window_pos);
-			this.void_window_pos = config.GetValue("VOID_WINDOW_POS", void_window_pos);
-			this.atmo_window_pos = config.GetValue("ATMO_WINDOW_POS", atmo_window_pos);
-			this.transfer_window_pos = config.GetValue("TAD_WINDOW_POS", transfer_window_pos);
-			this.vessel_register_window_pos = config.GetValue("VESREG_WINDOW_POS", vessel_register_window_pos);
-			this.data_logging_window_pos = config.GetValue("DATATIME_WINDOW_POS", data_logging_window_pos);
-			this.vessel_info_window_pos = config.GetValue("VESINFO_WINDOW_POS", vessel_info_window_pos);
-			this.misc_window_pos = config.GetValue("MISC_WINDOW_POS", misc_window_pos);
-			this.body_op_window_pos = config.GetValue("CELINFO_WINDOW_POS", body_op_window_pos);
-			this.rendezvous_info_window_pos = config.GetValue("RENDEZVOUS_WINDOW_POS", rendezvous_info_window_pos);
-			this.main_icon_pos = config.GetValue("ICON_POS", main_icon_pos);
-
-			this.toggleHUDModule = config.GetValue("HUD_MODULE", false);
-			this.void_module = config.GetValue("VOID_MODULE", false);
-			this.atmo_module = config.GetValue("ATMO_MODULE", false);
-			this.tad_module = config.GetValue("TAD_MODULE", false);
-			this.vessel_register_module = config.GetValue("VESREG_MODULE", false);
-			this.data_time_module = config.GetValue("DATATIME_MODULE", false);
-			this.vessel_info_module = config.GetValue("VESINFO_MODULE", false);
-			this.misc_module = config.GetValue("MISC_MODULE", false);
-			this.celestial_body_info_module = config.GetValue("CELINFO_MODULE", false);
-			this.body_op_show_orbital = config.GetValue("CELINFO_SHOW_OBTL", false);
-			this.body_op_show_physical = config.GetValue("CELINFO_SHOW_PHYS", false);
-			this.main_gui_minimized = config.GetValue("MAIN_GUI_MINIMIZED", false);
-			this.hide_on_pause = config.GetValue("HIDE_ON_PAUSE", false);
-			this.disable_power_usage = config.GetValue("DISABLE_POWER_USAGE", true);
-			this.show_tooltips = config.GetValue("SHOW_TOOLTIPS", false);
-			this.rendezvous_module = config.GetValue("SHOW_RENDEZVOUS_INFO", false);
-			this.hide_vesreg_info = config.GetValue("USE_KSP_TARGET", false);
-
-			this.skin_index = config.GetValue ("SKIN_INDEX", 0);
-
-			this.user_lang = (languages)Enum.Parse(typeof(languages), config.GetValue ("USER_LANG", "EN"));
-		}
-
-		private void LoadOldConfig()
-		{
-			if (KSP.IO.File.Exists<VOID_Config>("VOID.cfg", null))
-			{
-				string[] data = KSP.IO.File.ReadAllLines<VOID_Config>("VOID.cfg", null);
-				string[] name_val;
-				string[] temp;
-				string name = "";
-				string val = "";
-
-				foreach (string s in data)
-				{
-					name_val = s.Split('=');
-					name = name_val[0].Trim();
-					val = name_val[1].Trim();
-
-					if (val != "")
-					{
-						if (name == "MAIN WINDOW POS")
-						{
-							temp = val.Split(',');
-							//window_0_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10, 10);
-							main_window_pos.x = Convert.ToSingle(temp[0].Trim());
-							main_window_pos.y = Convert.ToSingle(temp[1].Trim());
-						}
-						if (name == "VOID WINDOW POS")
-						{
-							temp = val.Split(',');
-							void_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "ATMO WINDOW POS")
-						{
-							temp = val.Split(',');
-							atmo_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "TAD WINDOW POS")
-						{
-							temp = val.Split(',');
-							transfer_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "VESREG WINDOW POS")
-						{
-							temp = val.Split(',');
-							vessel_register_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "DATATIME WINDOW POS")
-						{
-							temp = val.Split(',');
-							data_logging_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "VESINFO WINDOW POS")
-						{
-							temp = val.Split(',');
-							vessel_info_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "MISC WINDOW POS")
-						{
-							temp = val.Split(',');
-							misc_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "CELINFO WINDOW POS")
-						{
-							temp = val.Split(',');
-							body_op_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "RENDEZVOUS WINDOW POS")
-						{
-							temp = val.Split(',');
-							rendezvous_info_window_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 10f, 10f);
-						}
-						if (name == "ICON POS")
-						{
-							temp = val.Split(',');
-							main_icon_pos = new Rect(Convert.ToSingle(temp[0].Trim()), Convert.ToSingle(temp[1].Trim()), 30f, 30f);
-						}
-						if (name == "HUD MODULE") toggleHUDModule = Boolean.Parse(val);
-						if (name == "VOID MODULE") void_module = Boolean.Parse(val);
-						if (name == "ATMO MODULE") atmo_module = Boolean.Parse(val);
-						if (name == "TAD MODULE") tad_module = Boolean.Parse(val);
-						if (name == "VESREG MODULE") vessel_register_module = Boolean.Parse(val);
-						if (name == "DATATIME MODULE") data_time_module = Boolean.Parse(val);
-						if (name == "VESINFO MODULE") vessel_info_module = Boolean.Parse(val);
-						if (name == "MISC MODULE") misc_module = Boolean.Parse(val);
-						if (name == "CELINFO MODULE") celestial_body_info_module = Boolean.Parse(val);
-						if (name == "CELINFO SHOW OBTL") body_op_show_orbital = Boolean.Parse(val);
-						if (name == "CELINFO SHOW PHYS") body_op_show_physical = Boolean.Parse(val);
-						if (name == "MAIN GUI MINIMIZED") main_gui_minimized = Boolean.Parse(val);
-						if (name == "HIDE ON PAUSE") hide_on_pause = Boolean.Parse(val);
-						if (name == "SKIN INDEX") skin_index = Int32.Parse(val);
-						if (name == "DISABLE POWER USAGE") disable_power_usage = Boolean.Parse(val);
-						if (name == "SHOW TOOLTIPS") show_tooltips = Boolean.Parse(val);
-						if (name == "SHOW RENDEZVOUS INFO") rendezvous_module = Boolean.Parse(val);
-						if (name == "USE KSP TARGET") hide_vesreg_info = Boolean.Parse(val);
-						if (name == "USER LANG") user_lang = (languages)Enum.Parse(typeof(languages), val);
-					}
-				}
-			}
-		}
-
-		public void SaveConfig()
-		{
-			Tools.PostDebugMessage ("VOID: Writing settings.");
-			try
-			{
-				var config = KSP.IO.PluginConfiguration.CreateForType<VOIDFlightMaster> ();
-				config.load ();
-
-				/*
-				config.SetValue ("ConfigVersion", this.configVersion);
-				config.SetValue("MAIN_WINDOW_POS", main_window_pos);
-				config.SetValue("VOID_WINDOW_POS", void_window_pos);
-				config.SetValue("ATMO_WINDOW_POS", atmo_window_pos);
-				config.SetValue("TAD_WINDOW_POS", transfer_window_pos);
-				config.SetValue("VESREG_WINDOW_POS", vessel_register_window_pos);
-				config.SetValue("DATATIME_WINDOW_POS", data_logging_window_pos);
-				config.SetValue("VESINFO_WINDOW_POS", vessel_info_window_pos);
-				config.SetValue("MISC_WINDOW_POS", misc_window_pos);
-				config.SetValue("CELINFO_WINDOW_POS", body_op_window_pos);
-				config.SetValue("RENDEZVOUS_WINDOW_POS", rendezvous_info_window_pos);
-				config.SetValue("ICON_POS", main_icon_pos);
-				config.SetValue("HUD_MODULE", toggleHUDModule);
-				config.SetValue("VOID_MODULE", void_module);
-				config.SetValue("ATMO_MODULE", atmo_module);
-				config.SetValue("TAD_MODULE", tad_module);
-				config.SetValue("VESREG_MODULE", vessel_register_module);
-				config.SetValue("DATATIME_MODULE", data_time_module);
-				config.SetValue("VESINFO_MODULE", vessel_info_module);
-				config.SetValue("MISC_MODULE", misc_module);
-				config.SetValue("CELINFO_MODULE", celestial_body_info_module);
-				config.SetValue("CELINFO_SHOW_OBTL", body_op_show_orbital);
-				config.SetValue("CELINFO_SHOW_PHYS", body_op_show_physical);
-				config.SetValue("MAIN_GUI_MINIMIZED", main_gui_minimized);
-				config.SetValue("HIDE_ON_PAUSE", hide_on_pause);
-				config.SetValue("SKIN_INDEX", skin_index);
-				config.SetValue("DISABLE_POWER_USAGE", disable_power_usage);
-				config.SetValue("SHOW_TOOLTIPS", show_tooltips);
-				config.SetValue("SHOW_RENDEZVOUS_INFO", rendezvous_module);
-				config.SetValue("USE_KSP_TARGET", hide_vesreg_info);
-				config.SetValue("USER_LANG", user_lang);
-				*/
-
-				try
-				{
-					config.SetValue ("ConfigVersion", this.configVersion);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue (\"ConfigVersion\", this.configVersion);");
-				}
-				try
-				{
-					config.SetValue("MAIN_WINDOW_POS", main_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"MAIN_WINDOW_POS\", main_window_pos);");
-				}
-				try
-				{
-					config.SetValue("VOID_WINDOW_POS", void_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"VOID_WINDOW_POS\", void_window_pos);");
-				}
-				try
-				{
-					config.SetValue("ATMO_WINDOW_POS", atmo_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"ATMO_WINDOW_POS\", atmo_window_pos);");
-				}
-				try
-				{
-					config.SetValue("TAD_WINDOW_POS", transfer_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"TAD_WINDOW_POS\", transfer_window_pos);");
-				}
-				try
-				{
-					config.SetValue("VESREG_WINDOW_POS", vessel_register_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"VESREG_WINDOW_POS\", vessel_register_window_pos);");
-				}
-				try
-				{
-					config.SetValue("DATATIME_WINDOW_POS", data_logging_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"DATATIME_WINDOW_POS\", data_logging_window_pos);");
-				}
-				try
-				{
-					config.SetValue("VESINFO_WINDOW_POS", vessel_info_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"VESINFO_WINDOW_POS\", vessel_info_window_pos);");
-				}
-				try
-				{
-					config.SetValue("MISC_WINDOW_POS", misc_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"MISC_WINDOW_POS\", misc_window_pos);");
-				}
-				try
-				{
-					config.SetValue("CELINFO_WINDOW_POS", body_op_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_WINDOW_POS\", body_op_window_pos);");
-				}
-				try
-				{
-					config.SetValue("RENDEZVOUS_WINDOW_POS", rendezvous_info_window_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"RENDEZVOUS_WINDOW_POS\", rendezvous_info_window_pos);");
-				}
-				try
-				{
-					config.SetValue("ICON_POS", main_icon_pos);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"ICON_POS\", main_icon_pos);");
-				}
-				try
-				{
-					config.SetValue("HUD_MODULE", toggleHUDModule);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"HUD_MODULE\", toggleHUDModule);");
-				}
-				try
-				{
-					config.SetValue("VOID_MODULE", void_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"VOID_MODULE\", void_module);");
-				}
-				try
-				{
-					config.SetValue("ATMO_MODULE", atmo_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"ATMO_MODULE\", atmo_module);");
-				}
-				try
-				{
-					config.SetValue("TAD_MODULE", tad_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"TAD_MODULE\", tad_module);");
-				}
-				try
-				{
-					config.SetValue("VESREG_MODULE", vessel_register_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"VESREG_MODULE\", vessel_register_module);");
-				}
-				try
-				{
-					config.SetValue("DATATIME_MODULE", data_time_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"DATATIME_MODULE\", data_time_module);");
-				}
-				try
-				{
-					config.SetValue("VESINFO_MODULE", vessel_info_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"VESINFO_MODULE\", vessel_info_module);");
-				}
-				try
-				{
-					config.SetValue("MISC_MODULE", misc_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"MISC_MODULE\", misc_module);");
-				}
-				try
-				{
-					config.SetValue("CELINFO_MODULE", celestial_body_info_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_MODULE\", celestial_body_info_module);");
-				}
-				try
-				{
-					config.SetValue("CELINFO_SHOW_OBTL", body_op_show_orbital);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_SHOW_OBTL\", body_op_show_orbital);");
-				}
-				try
-				{
-					config.SetValue("CELINFO_SHOW_PHYS", body_op_show_physical);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"CELINFO_SHOW_PHYS\", body_op_show_physical);");
-				}
-				try
-				{
-					config.SetValue("MAIN_GUI_MINIMIZED", main_gui_minimized);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"MAIN_GUI_MINIMIZED\", main_gui_minimized);");
-				}
-				try
-				{
-					config.SetValue("HIDE_ON_PAUSE", hide_on_pause);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"HIDE_ON_PAUSE\", hide_on_pause);");
-				}
-				try
-				{
-					config.SetValue("SKIN_INDEX", skin_index);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"SKIN_INDEX\", skin_index);");
-				}
-				try
-				{
-					config.SetValue("DISABLE_POWER_USAGE", disable_power_usage);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"DISABLE_POWER_USAGE\", disable_power_usage);");
-				}
-				try
-				{
-					config.SetValue("SHOW_TOOLTIPS", show_tooltips);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"SHOW_TOOLTIPS\", show_tooltips);");
-				}
-				try
-				{
-					config.SetValue("SHOW_RENDEZVOUS_INFO", rendezvous_module);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"SHOW_RENDEZVOUS_INFO\", rendezvous_module);");
-				}
-				try
-				{
-					config.SetValue("USE_KSP_TARGET", hide_vesreg_info);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"USE_KSP_TARGET\", hide_vesreg_info);");
-				}
-				try
-				{
-					config.SetValue("USER_LANG", user_lang);
-				}
-				catch (NullReferenceException)
-				{
-					UnityEngine.Debug.LogError("config.SetValue(\"USER_LANG\", user_lang);");
-				}
-				config.save ();
-			}
-			catch (NullReferenceException)
-			{
-				return;
-			}
-		}
-	}
-}
-
-

--- /dev/null
+++ b/VOID_ConfigValue.cs
@@ -1,1 +1,97 @@
+//
+//  VOID_Config.cs
+//
+//  Author:
+//       toadicus <>
+//
+//  Copyright (c) 2013 toadicus
+//
+//  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 3 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, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Collections.Generic;
+using KSP;
+using UnityEngine;
 
+namespace VOID
+{
+	public struct VOID_ConfigValue<T> : IVOID_ConfigValue
+	{
+		private T _value;
+		private Type _type;
+
+		public T value
+		{
+			get
+			{
+				return this._value;
+			}
+			set
+			{
+				this._value = value;
+			}
+		}
+
+		public Type type
+		{
+			get
+			{
+				return this._type;
+			}
+			set
+			{
+				this._type = value;
+			}
+		}
+
+		public static implicit operator T(VOID_ConfigValue<T> v)
+		{
+			return v.value;
+		}
+
+		public static implicit operator VOID_ConfigValue<T>(T v)
+		{
+			VOID_ConfigValue<T> r = new VOID_ConfigValue<T>();
+			r.value = v;
+			r.type = v.GetType();
+			VOID_Core.Instance.configDirty = true;
+			return r;
+		}
+	}
+
+	public interface IVOID_ConfigValue
+	{
+		Type type { get; }
+	}
+
+	[AttributeUsage(AttributeTargets.Field)]
+	public class AVOID_ConfigValue : Attribute
+	{
+		protected string _name;
+
+		public string Name
+		{
+			get
+			{
+				return this._name;
+			}
+		}
+
+		public AVOID_ConfigValue(string fieldName)
+		{
+			this._name = fieldName;
+		}
+	}
+}
+
+

--- a/VOID_Core.cs
+++ b/VOID_Core.cs
@@ -19,25 +19,27 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 using System;
+using System.Collections.Generic;
+using System.Linq;
 using KSP;
 using UnityEngine;
 
 namespace VOID
 {
-	public class VOID_Core : IVOID_Module
+	public class VOID_Core : VOID_Module, IVOID_Module
 	{
 		/*
 		 * Static Members
 		 * */
 		protected static VOID_Core _instance;
-
-		public static IVOID_Module Instance {
-			get {
-				if (_instance == null) {
-					Tools.PostDebugMessage ("Instantiating VOID_HUD");
-					_instance = new VOID_Core ();
-				}
-				Tools.PostDebugMessage ("Returning VOID_HUD instance.");
+		public static VOID_Core Instance
+		{
+			get
+			{
+				if (_instance == null)
+				{
+					_instance = new VOID_Core();
+				}
 				return _instance;
 			}
 		}
@@ -45,74 +47,304 @@
 		/*
 		 * Fields
 		 * */
-		protected Rect main_window_pos = new Rect(Screen.width / 2, Screen.height / 2, 10f, 10f); //VOID main
-
-		protected Rect main_icon_pos = new Rect(Screen.width / 2 - 80, Screen.height - 32, 30f, 30f);
-		protected Texture2D void_icon_off = new Texture2D(30, 30, TextureFormat.ARGB32, false);
-		protected Texture2D void_icon_on = new Texture2D(30, 30, TextureFormat.ARGB32, false);
-		protected Texture2D void_icon = new Texture2D(30, 30, TextureFormat.ARGB32, false);
-
-		protected bool _Active = true;
-		protected bool _Running = false;
+		protected string VoidName = "VOID";
+		protected string VoidVersion = "0.9.9";
+
+		[AVOID_ConfigValue("configValue")]
+		protected VOID_ConfigValue<int> configVersion = 1;
+
+		protected List<VOID_Module> _modules = new List<VOID_Module>();
+
+		[AVOID_ConfigValue("mainWindowPos")]
+		protected VOID_ConfigValue<Rect> mainWindowPos = new Rect(Screen.width / 2, Screen.height / 2, 10f, 10f);
+
+		[AVOID_ConfigValue("mainGuiMinimized")]
+		protected VOID_ConfigValue<bool> mainGuiMinimized = false;
+
+		[AVOID_ConfigValue("configWindowPos")]
+		protected VOID_ConfigValue<Rect> configWindowPos = new Rect(Screen.width / 2, Screen.height  /2, 10f, 10f);
+
+		[AVOID_ConfigValue("configWindowMinimized")]
+		protected VOID_ConfigValue<bool> configWindowMinimized = true;
+
+		[AVOID_ConfigValue("VOIDIconPos")]
+		protected VOID_ConfigValue<Rect> VOIDIconPos = new Rect(Screen.width / 2 - 200, Screen.height - 30, 30f, 30f);
+		protected Texture2D VOIDIconOff = new Texture2D(30, 30, TextureFormat.ARGB32, false);
+		protected Texture2D VOIDIconOn = new Texture2D(30, 30, TextureFormat.ARGB32, false);
+		protected Texture2D VOIDIconTexture;
+		protected string VOIDIconOnPath = "VOID/Textures/void_icon_on";
+		protected string VOIDIconOffPath = "VOID/Textures/void_icon_off";
+
+		protected int windowBaseID = -96518722;
+
+		public VOID_ConfigValue<bool> togglePower = true;
+		public bool powerAvailable = true;
+		protected VOID_ConfigValue<bool> consumeResource = false;
+		protected VOID_ConfigValue<string> resourceName = "ElectricCharge";
+		protected VOID_ConfigValue<float> resourceRate = 0.2f;
+
+		public float saveTimer = 0;
+
+		protected string defaultSkin = "KSP window 2";
+		protected VOID_ConfigValue<string> _skin;
+
+		public bool configDirty;
+
 		/*
 		 * Properties
 		 * */
-		public bool hasGUIConfig
+		public List<VOID_Module> Modules
 		{
 			get
 			{
-				return false;
-			}
-		}
-
-		public bool toggleActive
+				return this._modules;
+			}
+		}
+
+		public GUISkin Skin
 		{
 			get
 			{
-				return this._Active;
-			}
-			set
-			{
-				this._Active = value;
-			}
-		}
-
-		public bool guiRunning
+				if (this._skin == null)
+				{
+					this._skin = this.defaultSkin;
+				}
+				return AssetBase.GetGUISkin(this._skin);
+			}
+		}
+
+		public Vessel vessel
 		{
 			get
 			{
-				return this._Running;
+				return FlightGlobals.ActiveVessel;
 			}
 		}
 
 		/*
 		 * Methods
 		 * */
-		public void DrawGUI()
-		{
-
-		}
-
-		public void StartGUI()
-		{
-			RenderingManager.AddToPostDrawQueue(3, this.DrawGUI);
-		}
-
-		public void StopGUI()
-		{
-			RenderingManager.RemoveFromPostDrawQueue(3, this.DrawGUI);
-		}
-
-		public void LoadConfig()
+		protected VOID_Core()
+		{
+			this._Name = "VOID Core";
+
+			this.VOIDIconOn = GameDatabase.Instance.GetTexture (this.VOIDIconOnPath, false);
+			this.VOIDIconOff = GameDatabase.Instance.GetTexture (this.VOIDIconOffPath, false);
+		}
+
+		public void LoadModule(Type T)
+		{
+			this._modules.Add (Activator.CreateInstance (T) as VOID_Module);
+		}
+
+		public void Update()
+		{
+			this.saveTimer += Time.deltaTime;
+
+			if (!this.guiRunning)
+			{
+				this.StartGUI ();
+			}
+
+			foreach (VOID_Module module in this.Modules)
+			{
+				if (!module.guiRunning && module.toggleActive)
+				{
+					module.StartGUI ();
+				}
+				if (module.guiRunning && !module.toggleActive || !this.togglePower)
+				{
+					module.StopGUI();
+				}
+			}
+
+			if (this.saveTimer > 15f)
+			{
+				this.SaveConfig ();
+				this.saveTimer = 0;
+			}
+		}
+
+		public void FixedUpdate()
+		{
+			if (this.consumeResource &&
+			    this.vessel.vesselType != VesselType.EVA &&
+			    TimeWarp.deltaTime != 0
+			    )
+			{
+				float powerReceived = this.vessel.rootPart.RequestResource(this.resourceName,
+				                                                          this.resourceRate * TimeWarp.fixedDeltaTime);
+				if (powerReceived > 0)
+				{
+					this.powerAvailable = true;
+				}
+				else
+				{
+					this.powerAvailable = false;
+				}
+			}
+		}
+
+		public void VOIDMainWindow(int _)
+		{
+			GUILayout.BeginVertical();
+			
+			if (this.powerAvailable)
+			{
+				string str = "ON";
+				if (togglePower) str = "OFF";
+				if (GUILayout.Button("Power " + str)) togglePower = !togglePower;
+			    if (togglePower)
+			    {
+					foreach (VOID_Module module in this.Modules)
+					{
+						module.toggleActive = GUILayout.Toggle (module.toggleActive, module.Name);
+					}
+			    }
+			}
+			else
+			{
+			    GUIStyle label_txt_red = new GUIStyle(GUI.skin.label);
+			    label_txt_red.normal.textColor = Color.red;
+			    label_txt_red.alignment = TextAnchor.MiddleCenter;
+			    GUILayout.Label("-- POWER LOST --", label_txt_red);
+			}
+
+			this.configWindowMinimized = !GUILayout.Toggle (!this.configWindowMinimized, "Configuration");
+
+			GUILayout.EndVertical();
+			GUI.DragWindow();
+		}
+
+		public void VOIDConfigWindow(int _)
+		{
+			GUILayout.BeginVertical ();
+
+			this.consumeResource = GUILayout.Toggle (this.consumeResource, "Consume Resources");
+
+			GUILayout.EndVertical ();
+			GUI.DragWindow ();
+		}
+
+		public override void DrawGUI()
+		{
+			GUI.skin = this.Skin;
+
+			int windowID = this.windowBaseID;
+
+            this.VOIDIconTexture = this.VOIDIconOff;  //icon off default
+			if (this.togglePower) this.VOIDIconTexture = this.VOIDIconOn;     //or on if power_toggle==true
+			if (GUI.Button(new Rect(VOIDIconPos), VOIDIconTexture, new GUIStyle()))
+			{
+				this.mainGuiMinimized = !this.mainGuiMinimized;
+			}
+
+			if (!this.mainGuiMinimized)
+			{
+				this.mainWindowPos = GUILayout.Window (
+					++windowID,
+					this.mainWindowPos,
+					this.VOIDMainWindow,
+					string.Join (" ", this.VoidName, this.VoidVersion),
+					GUILayout.Width (250),
+					GUILayout.Height (50)
+				);
+			}
+
+			if (!this.configWindowMinimized)
+			{
+				this.configWindowPos = GUILayout.Window (
+					++windowID,
+					this.configWindowPos,
+					this.VOIDConfigWindow,
+					string.Join (" ", this.VoidName, "Configuration"),
+					GUILayout.Width (250),
+					GUILayout.Height (50)
+				);
+			}
+		}
+
+		public new void StartGUI()
+		{
+			base.StartGUI ();
+			foreach (var module in this._modules)
+			{
+				if (module.toggleActive)
+				{
+					module.StartGUI ();
+				}
+			}
+
+			this._Running = true;
+		}
+
+		public new void StopGUI()
+		{
+			base.StopGUI ();
+			foreach (var module in this._modules)
+			{
+				if (module.guiRunning)
+				{
+					module.StopGUI ();
+				}
+			}
+
+			this._Running = false;
+		}
+
+		public override void LoadConfig()
 		{
 			var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core>();
 			config.load();
-			this.main_window_pos = config.GetValue("main_window_pos", this.main_window_pos);
-			this.main_icon_pos = config.GetValue("main_icon_pos", this.main_icon_pos);
-		}
-
-		public void SaveConfig()
-		{
+
+			if (this.configVersion > config.GetValue("configVersion", 0))
+			{
+				// TODO: Config update stuff.
+			}
+
+			foreach (var field in this.GetType().GetFields().Where(f => f.IsDefined(typeof(AVOID_ConfigValue), false)))
+			{
+				var attr = field.GetCustomAttributes(typeof(AVOID_ConfigValue), false)[0];
+				string fieldName = (attr as AVOID_ConfigValue).Name;
+
+				var fieldValue = field.GetValue(this);
+
+				field.SetValue(
+					this,
+					config.GetValue(fieldName, fieldValue)
+				);
+			}
+
+			foreach (VOID_Module module in this.Modules)
+			{
+				module.LoadConfig ();
+			}
+		}
+
+		public override void SaveConfig()
+		{
+			var config = KSP.IO.PluginConfiguration.CreateForType<VOID_Core> ();
+			config.load ();
+
+			foreach (var field in this.GetType().GetFields().Where(f => f.IsDefined(typeof(AVOID_ConfigValue), false)))
+			{
+				var attr = field.GetCustomAttributes(typeof(AVOID_ConfigValue), false)[0];
+				string fieldName = (attr as AVOID_ConfigValue).Name;
+
+				object fieldValue = field.GetValue(this);
+				Type T = (fieldValue as IVOID_ConfigValue).type;
+
+				config.SetValue(fieldName, fieldValue);
+			}
+
+			config.save ();
+
+			foreach (VOID_Module module in this.Modules)
+			{
+				module.SaveConfig ();
+			}
+
+			this.configDirty = false;
 		}
 	}
 }

--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -27,24 +27,8 @@
 
 namespace VOID
 {
-	public class VOID_HUD : IVOID_Module
+	public class VOID_HUD : VOID_Module, IVOID_Module
 	{
-		/*
-		 * Static Members
-		 * */
-		protected static VOID_HUD _instance;
-
-		public static IVOID_Module Instance {
-			get {
-				if (_instance == null) {
-					Tools.PostDebugMessage ("Instantiating VOID_HUD");
-					_instance = new VOID_HUD ();
-				}
-				Tools.PostDebugMessage ("Returning VOID_HUD instance.");
-				return _instance;
-			}
-		}
-
 		/*
 		 * Fields
 		 * */
@@ -56,15 +40,6 @@
 
 		protected Vessel vessel = null;
 
-		public bool guiRunning = false;
-
-		public bool hasGUIConfig
-		{
-			get
-			{
-				return false;
-			}
-		}
 		/*
 		 * Properties
 		 * */
@@ -89,8 +64,9 @@
 		/* 
 		 * Methods
 		 * */
-		private VOID_HUD() : base()
+		public VOID_HUD() : base()
 		{
+			this._Name = "Heads-Up Display";
 			this.textColors.Add(Color.green);
 			this.textColors.Add(Color.black);
 			this.textColors.Add(Color.white);
@@ -103,16 +79,16 @@
 
 			this.labelStyle = new GUIStyle ();
 			this.labelStyle.normal.textColor = this.textColors [this.ColorIndex];
+
+			Tools.PostDebugMessage ("VOID_HUD: Constructed.");
 		}
 
-		~VOID_HUD()
-		{
-			this.SaveConfig();
-		}
-
-		public void DrawGUI()
+		public override void DrawGUI()
 		{
 			Tools.PostDebugMessage ("VOID_HUD: Drawing GUI.");
+
+			GUI.skin = VOID_Core.Instance.Skin;
+
 			if (vessel == null)
 			{
 				vessel = FlightGlobals.ActiveVessel;
@@ -123,60 +99,43 @@
 				vessel = FlightGlobals.ActiveVessel;
 			}
 
-			if (true)
+			if (VOID_Core.Instance.powerAvailable)
 			{
-				if (true)
-				{
-					labelStyle.normal.textColor = textColors [ColorIndex];
+				labelStyle.normal.textColor = textColors [ColorIndex];
 
-					GUI.Label (
-						new Rect ((Screen.width * .2083f), 0, 300f, 70f),
-						"Obt Alt: " + Tools.MuMech_ToSI (vessel.orbit.altitude) + "m" +
-						" Obt Vel: " + Tools.MuMech_ToSI (vessel.orbit.vel.magnitude) + "m/s" +
-						"\nAp: " + Tools.MuMech_ToSI (vessel.orbit.ApA) + "m" +
-						" ETA " + Tools.ConvertInterval (vessel.orbit.timeToAp) +
-						"\nPe: " + Tools.MuMech_ToSI (vessel.orbit.PeA) + "m" +
-						" ETA " + Tools.ConvertInterval (vessel.orbit.timeToPe) +
-						"\nInc: " + vessel.orbit.inclination.ToString ("F3") + "°",
-						labelStyle);
-					// Toadicus edit: Added "Biome: " line to surf/atmo HUD
-					GUI.Label (
-						new Rect ((Screen.width * .625f), 0, 300f, 90f),
-						"Srf Alt: " + Tools.MuMech_ToSI (Tools.TrueAltitude (vessel)) + "m" +
-						" Srf Vel: " + Tools.MuMech_ToSI (vessel.srf_velocity.magnitude) + "m/s" +
-						"\nVer: " + Tools.MuMech_ToSI (vessel.verticalSpeed) + "m/s" +
-						" Hor: " + Tools.MuMech_ToSI (vessel.horizontalSrfSpeed) + "m/s" +
-						"\nLat: " + Tools.GetLatitudeString (vessel, "F3") +
-						" Lon: " + Tools.GetLongitudeString (vessel, "F3") +
-						"\nHdg: " + Tools.MuMech_get_heading (vessel).ToString ("F2") + "° " +
-						Tools.get_heading_text (Tools.MuMech_get_heading (vessel)) +
-						"\nBiome: " + Tools.Toadicus_GetAtt (vessel).name,
-						labelStyle);
-				}
-				else
-				{
-					labelStyle.normal.textColor = Color.red;
-					GUI.Label (new Rect ((Screen.width * .2083f), 0, 300f, 70f), "-- POWER LOST --", labelStyle);
-					GUI.Label (new Rect ((Screen.width * .625f), 0, 300f, 70f), "-- POWER LOST --", labelStyle);
-				}
+				GUI.Label (
+					new Rect ((Screen.width * .2083f), 0, 300f, 70f),
+					"Obt Alt: " + Tools.MuMech_ToSI (vessel.orbit.altitude) + "m" +
+					" Obt Vel: " + Tools.MuMech_ToSI (vessel.orbit.vel.magnitude) + "m/s" +
+					"\nAp: " + Tools.MuMech_ToSI (vessel.orbit.ApA) + "m" +
+					" ETA " + Tools.ConvertInterval (vessel.orbit.timeToAp) +
+					"\nPe: " + Tools.MuMech_ToSI (vessel.orbit.PeA) + "m" +
+					" ETA " + Tools.ConvertInterval (vessel.orbit.timeToPe) +
+					"\nInc: " + vessel.orbit.inclination.ToString ("F3") + "°",
+					labelStyle);
+				// Toadicus edit: Added "Biome: " line to surf/atmo HUD
+				GUI.Label (
+					new Rect ((Screen.width * .625f), 0, 300f, 90f),
+					"Srf Alt: " + Tools.MuMech_ToSI (Tools.TrueAltitude (vessel)) + "m" +
+					" Srf Vel: " + Tools.MuMech_ToSI (vessel.srf_velocity.magnitude) + "m/s" +
+					"\nVer: " + Tools.MuMech_ToSI (vessel.verticalSpeed) + "m/s" +
+					" Hor: " + Tools.MuMech_ToSI (vessel.horizontalSrfSpeed) + "m/s" +
+					"\nLat: " + Tools.GetLatitudeString (vessel, "F3") +
+					" Lon: " + Tools.GetLongitudeString (vessel, "F3") +
+					"\nHdg: " + Tools.MuMech_get_heading (vessel).ToString ("F2") + "° " +
+					Tools.get_heading_text (Tools.MuMech_get_heading (vessel)) +
+					"\nBiome: " + Tools.Toadicus_GetAtt (vessel).name,
+					labelStyle);
+			}
+			else
+			{
+				labelStyle.normal.textColor = Color.red;
+				GUI.Label (new Rect ((Screen.width * .2083f), 0, 300f, 70f), "-- POWER LOST --", labelStyle);
+				GUI.Label (new Rect ((Screen.width * .625f), 0, 300f, 70f), "-- POWER LOST --", labelStyle);
 			}
 		}
 
-		public void StartGUI()
-		{
-			Tools.PostDebugMessage ("Adding VOID_HUD to the draw queue.");
-			RenderingManager.AddToPostDrawQueue (3, new Callback(this.DrawGUI));
-			this.guiRunning = true;
-		}
-
-		public void StopGUI()
-		{
-			Tools.PostDebugMessage ("Removing VOID_HUD from the draw queue.");
-			RenderingManager.RemoveFromPostDrawQueue (3, new Callback(this.DrawGUI));
-			this.guiRunning = false;
-		}
-
-		public void SaveConfig()
+		public override void SaveConfig()
 		{
 			Tools.PostDebugMessage ("VOID_HUD: Saving Config.");
 			var config = KSP.IO.PluginConfiguration.CreateForType<VOID_HUD> ();
@@ -185,7 +144,7 @@
 			config.save ();
 		}
 
-		public void LoadConfig()
+		public override void LoadConfig()
 		{
 			Tools.PostDebugMessage ("VOID_HUD: Loading Config.");
 			var config = KSP.IO.PluginConfiguration.CreateForType<VOID_HUD> ();

file:b/VOID_Module.cs (new)
--- /dev/null
+++ b/VOID_Module.cs
@@ -1,1 +1,105 @@
+//
+//  VOID_Module.cs
+//
+//  Author:
+//       toadicus <>
+//
+//  Copyright (c) 2013 toadicus
+//
+//  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 3 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, see <http://www.gnu.org/licenses/>.
+using System;
 
+namespace VOID
+{
+	public abstract class VOID_Module
+	{
+		/*
+		 * Fields
+		 * */
+		protected bool _Active = true;
+		protected bool _Running = false;
+		protected bool _hasGUICfg = false;
+
+		protected string _Name;
+
+		/*
+		 * Properties
+		 * */
+		public virtual bool hasGUIConfig
+		{
+			get
+			{
+				return this._hasGUICfg;
+			}
+		}
+
+		public virtual bool toggleActive
+		{
+			get
+			{
+				return this._Active;
+			}
+			set
+			{
+				this._Active = value;
+			}
+		}
+
+		public virtual bool guiRunning
+		{
+			get
+			{
+				return this._Running;
+			}
+		}
+
+		public virtual string Name
+		{
+			get
+			{
+				return this._Name;
+			}
+		}
+
+		/*
+		 * Methods
+		 * */
+		public void StartGUI()
+		{
+			Tools.PostDebugMessage (string.Format("Adding {0} to the draw queue.", this.GetType().Name));
+			RenderingManager.AddToPostDrawQueue (3, this.DrawGUI);
+			this._Running = true;
+		}
+
+		public void StopGUI()
+		{
+			Tools.PostDebugMessage (string.Format("Removing {0} from the draw queue.", this.GetType().Name));
+			RenderingManager.RemoveFromPostDrawQueue (3, this.DrawGUI);
+			this._Running = false;
+		}
+
+		public abstract void DrawGUI();
+
+		public abstract void LoadConfig();
+
+		public abstract void SaveConfig();
+
+		~VOID_Module()
+		{
+			this.SaveConfig ();
+		}
+	}
+}
+
+