Version 0.18.3 0.18.3
Version 0.18.3

--- a/API/VOID_Module.cs
+++ b/API/VOID_Module.cs
@@ -28,7 +28,6 @@
 
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Reflection;
 using ToadicusTools;
 using UnityEngine;
@@ -286,11 +285,16 @@
 
 				object[] attrs = member.GetCustomAttributes(typeof(AVOID_SaveValue), false);
 
-				if (attrs.Length == 0) {
+				AVOID_SaveValue attr;
+
+				if (attrs.Length > 0)
+				{
+					attr = (AVOID_SaveValue)attrs[0];
+				}
+				else
+				{
 					continue;
 				}
-
-				AVOID_SaveValue attr = attrs.FirstOrDefault () as AVOID_SaveValue;
 
 				string fieldName = string.Empty;
 
@@ -381,11 +385,16 @@
 
 				object[] attrs = member.GetCustomAttributes(typeof(AVOID_SaveValue), false);
 
-				if (attrs.Length == 0) {
+				AVOID_SaveValue attr;
+
+				if (attrs.Length > 0)
+				{
+					attr = (AVOID_SaveValue)attrs[0];
+				}
+				else
+				{
 					continue;
 				}
-
-				AVOID_SaveValue attr = attrs.FirstOrDefault () as AVOID_SaveValue;
 
 				string fieldName;
 

--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -39,10 +39,9 @@
 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("0.18.2.*")]
+[assembly: AssemblyVersion("0.18.3.*")]
 // The following attributes are used to specify the signing key for the assembly,
 // if desired. See the Mono documentation for more information about signing.
 //[assembly: AssemblyDelaySign(false)]
 //[assembly: AssemblyKeyFile("")]
 
-

--- a/VOIDCore_Editor.cs
+++ b/VOIDCore_Editor.cs
@@ -30,7 +30,6 @@
 using KSP;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using ToadicusTools;
 using UnityEngine;
 

--- a/VOIDCore_Generic.cs
+++ b/VOIDCore_Generic.cs
@@ -32,7 +32,6 @@
 using KSP;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Text;
 using ToadicusTools;
 using UnityEngine;
@@ -107,7 +106,7 @@
 		protected int skinIdx;
 
 		protected Dictionary<string, GUISkin> validSkins;
-		protected string[] skinNames;
+		protected List<string> skinNames;
 		protected string[] forbiddenSkins =
 			{
 				"PlaqueDialogSkin",
@@ -723,10 +722,10 @@
 				));
 			}
 
-			this.skinIdx %= this.skinNames.Length;
+			this.skinIdx %= this.skinNames.Count;
 			if (this.skinIdx < 0)
 			{
-				this.skinIdx += this.skinNames.Length;
+				this.skinIdx += this.skinNames.Count;
 			}
 
 			if (this.skinName != skinNames[this.skinIdx])
@@ -794,9 +793,9 @@
 
 			this.Stages = SimManager.Stages;
 
-			if (this.Stages != null)
-			{
-				this.LastStage = this.Stages.Last();
+			if (this.Stages != null && this.Stages.Length > 0)
+			{
+				this.LastStage = this.Stages[this.Stages.Length - 1];
 			}
 		}
 
@@ -853,15 +852,15 @@
 
 		protected void LoadModule(Type T)
 		{
-			var existingModules = this.modules.Where(mod => mod.GetType().Name == T.Name);
-			if (existingModules.Any())
-			{
-				Tools.PostDebugMessage(string.Format(
-					"{0}: refusing to load {1}: already loaded",
-					this.GetType().Name,
-					T.Name
-				));
-				return;
+			/*var existingModules = this.modules.Where(mod => mod.GetType().Name == T.Name);
+			if (existingModules.Any())*/
+			for (int mIdx = 0; mIdx < this.modules.Count; mIdx++)
+			{
+				if (this.modules[mIdx].Name == T.Name)
+				{
+					Tools.PostErrorMessage("{0}: refusing to load {1}: already loaded", this.GetType().Name, T.Name);
+					return;
+				}
 			}
 
 			var InstanceProperty = T.GetProperty(
@@ -910,20 +909,21 @@
 
 		protected void LoadSkins()
 		{
-			Tools.PostDebugMessage("AssetBase has skins: \n" +
-				string.Join("\n\t",
-					Resources.FindObjectsOfTypeAll(typeof(GUISkin))
-					.Select(s => s.ToString())
-					.ToArray()
-				)
-			);
-
-			this.validSkins = Resources.FindObjectsOfTypeAll(typeof(GUISkin))
-				.Where(s => !this.forbiddenSkins.Contains(s.name))
-				.Select(s => s as GUISkin)
-				.GroupBy(s => s.name)
-				.Select(g => g.First())
-				.ToDictionary(s => s.name);
+			this.validSkins = new Dictionary<string, GUISkin>();
+			this.skinNames = new List<string>();
+
+			UnityEngine.Object[] skins = Resources.FindObjectsOfTypeAll(typeof(GUISkin));
+			GUISkin skin;
+			for (int sIdx = 0; sIdx < skins.Length; sIdx++)
+			{
+				skin = (GUISkin)skins[sIdx];
+
+				if (!this.forbiddenSkins.Contains(skin.name))
+				{
+					this.validSkins[skin.name] = skin;
+					this.skinNames.Add(skin.name);
+				}
+			}
 
 			Tools.PostDebugMessage(string.Format(
 				"{0}: loaded {1} GUISkins.",
@@ -931,12 +931,11 @@
 				this.validSkins.Count
 			));
 
-			this.skinNames = this.validSkins.Keys.ToArray();
-			Array.Sort(this.skinNames);
+			this.skinNames.Sort();
 
 			int defaultIdx = int.MinValue;
 
-			for (int i = 0; i < this.skinNames.Length; i++)
+			for (int i = 0; i < this.skinNames.Count; i++)
 			{
 				if (this.skinNames[i] == this.skinName)
 				{
@@ -982,7 +981,14 @@
 		{
 			if (!this.vesselTypesLoaded)
 			{
-				this.AllVesselTypes = Enum.GetValues(typeof(VesselType)).OfType<VesselType>().ToArray();
+				Array typeObjs = Enum.GetValues(typeof(VesselType));
+				this.AllVesselTypes = new VesselType[typeObjs.Length];
+
+				for (int idx = 0; idx < typeObjs.Length; idx++)
+				{
+					this.AllVesselTypes[idx] = (VesselType)typeObjs.GetValue(idx);
+				}
+
 				this.vesselTypesLoaded = true;
 			}
 
@@ -991,8 +997,6 @@
 				this.SortedBodyList = new List<CelestialBody>(FlightGlobals.Bodies);
 				this.SortedBodyList.Sort(new CBListComparer());
 				this.SortedBodyList.Reverse();
-
-				Debug.Log(string.Format("sortedBodyList: {0}", string.Join("\n\t", this.SortedBodyList.Select(b => b.bodyName).ToArray())));
 			}
 
 			// SimManager initialization that we don't necessarily want to repeat every Update.

--- a/VOID_DataLogger.cs
+++ b/VOID_DataLogger.cs
@@ -305,7 +305,7 @@
 			//called if logging is on and interval has passed
 			//writes one line to the csvList
 
-			StringBuilder line = new StringBuilder();
+			StringBuilder line = Tools.GetStringBuilder();
 
 			if (firstWrite)
 			{
@@ -408,6 +408,8 @@
 			csvBytes.AddRange(this.utf8Encoding.GetBytes(line.ToString()));
 
 			this.csvCollectTimer = 0f;
+
+			Tools.PutStringBuilder(line);
 		}
 
 		#endregion

--- a/VOID_EditorHUD.cs
+++ b/VOID_EditorHUD.cs
@@ -30,7 +30,6 @@
 using KSP;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Text;
 using ToadicusTools;
 using UnityEngine;
@@ -58,9 +57,12 @@
 			{
 				if (this._vesselOverlays == null)
 				{
-					this._vesselOverlays = (EditorVesselOverlays)Resources
-						.FindObjectsOfTypeAll(typeof(EditorVesselOverlays))
-						.FirstOrDefault();
+					UnityEngine.Object[] overlayObjs = Resources.FindObjectsOfTypeAll(typeof(EditorVesselOverlays));
+
+					if (overlayObjs.Length > 0)
+					{
+						this._vesselOverlays = (EditorVesselOverlays)overlayObjs[0];
+					}
 				}
 
 				return this._vesselOverlays;
@@ -116,7 +118,7 @@
 
 		public void ehudWindowFunc(int id)
 		{
-			StringBuilder hudString = new StringBuilder();
+			StringBuilder hudString = Tools.GetStringBuilder();
 
 			if (this.core.LastStage == null)
 			{
@@ -190,6 +192,8 @@
 			}
 
 			GUI.BringWindowToBack(id);
+
+			Tools.PutStringBuilder(hudString);
 		}
 
 		public override void DrawGUI()

--- a/VOID_HUD.cs
+++ b/VOID_HUD.cs
@@ -70,7 +70,7 @@
 		{
 			StringBuilder leftHUD;
 
-			leftHUD = new StringBuilder();
+			leftHUD = Tools.GetStringBuilder();
 
 			VOID_Styles.labelHud.alignment = TextAnchor.UpperRight;
 
@@ -116,13 +116,15 @@
 			}
 
 			GUI.BringWindowToBack(id);
+
+			Tools.PutStringBuilder(leftHUD);
 		}
 
 		protected void rightHUDWindow(int id)
 		{
 			StringBuilder rightHUD;
 
-			rightHUD = new StringBuilder();
+			rightHUD = Tools.GetStringBuilder();
 
 			VOID_Styles.labelHud.alignment = TextAnchor.UpperLeft;
 
@@ -182,6 +184,8 @@
 			}
 
 			GUI.BringWindowToBack(id);
+
+			Tools.PutStringBuilder(rightHUD);
 		}
 	}
 }

--- a/VOID_HUDAdvanced.cs
+++ b/VOID_HUDAdvanced.cs
@@ -30,7 +30,6 @@
 using KSP;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Text;
 using ToadicusTools;
 using UnityEngine;
@@ -104,7 +103,7 @@
 		{
 			StringBuilder leftHUD;
 
-			leftHUD = new StringBuilder();
+			leftHUD = Tools.GetStringBuilder();
 
 			VOID_Styles.labelHud.alignment = TextAnchor.UpperRight;
 
@@ -162,13 +161,15 @@
 			}
 
 			GUI.BringWindowToBack(id);
+
+			Tools.PutStringBuilder(leftHUD);
 		}
 
 		protected void rightHUDWindow(int id)
 		{
 			StringBuilder rightHUD;
 
-			rightHUD = new StringBuilder();
+			rightHUD = Tools.GetStringBuilder();
 
 			VOID_Styles.labelHud.alignment = TextAnchor.UpperLeft;
 
@@ -226,6 +227,8 @@
 			}
 
 			GUI.BringWindowToBack(id);
+
+			Tools.PutStringBuilder(rightHUD);
 		}
 
 		public override void DrawGUI()

--- a/VOID_Rendezvous.cs
+++ b/VOID_Rendezvous.cs
@@ -29,7 +29,6 @@
 using KSP;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using ToadicusTools;
 using UnityEngine;
 
@@ -58,12 +57,19 @@
 
 		public override void ModuleWindow(int id)
 		{
-			Vessel rendezvessel = new Vessel();
-			CelestialBody rendezbody = new CelestialBody();
+			Vessel rendezvessel;
+			CelestialBody rendezbody;
 
 			if (this.RegisterModule == null)
 			{
-				this.RegisterModule = this.core.Modules.Where(m => typeof(VOID_VesselRegister).IsAssignableFrom(m.GetType())).FirstOrDefault() as VOID_VesselRegister;
+				for (int idx = 0; idx < this.core.Modules.Count; idx++)
+				{
+					if (this.core.Modules[idx] is VOID_VesselRegister)
+					{
+						this.RegisterModule = this.core.Modules[idx] as VOID_VesselRegister;
+						break;
+					}
+				}
 			}
 
 			GUILayout.BeginVertical();

--- a/VOID_StageInfo.cs
+++ b/VOID_StageInfo.cs
@@ -7,7 +7,6 @@
 using KSP;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using ToadicusTools;
 using UnityEngine;
 

--- a/VOID_Transfer.cs
+++ b/VOID_Transfer.cs
@@ -29,7 +29,6 @@
 using KSP;
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using ToadicusTools;
 using UnityEngine;
 

--- a/VOID_VesselRegister.cs
+++ b/VOID_VesselRegister.cs
@@ -28,7 +28,6 @@
 
 using KSP;
 using System;
-using System.Linq;
 using ToadicusTools;
 using UnityEngine;
 
@@ -76,7 +75,7 @@
 
 		public override void ModuleWindow(int id)
 		{
-			if (!this.core.AllVesselTypes.Any())
+			if (this.core.AllVesselTypes.Length < 1)
 			{
 				return;
 			}