Code cleanup.
Code cleanup.

--- a/KerbalEngineer/BuildEngineer/BuildAdvanced.cs
+++ b/KerbalEngineer/BuildEngineer/BuildAdvanced.cs
@@ -1,453 +1,561 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Settings;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.BuildEngineer
-{
-    [KSPAddon(KSPAddon.Startup.EditorAny, false)]
-    public class BuildAdvanced : MonoBehaviour
-    {
-        #region Instance
-
-        /// <summary>
-        /// Gets the current instance if started or returns null.
-        /// </summary>
-        public static BuildAdvanced Instance { get; private set; }
-
-        #endregion
-
-        #region Fields
-
-        private Rect _windowPosition = new Rect(265f, 45f, 0f, 0f);
-        private GUIStyle _windowStyle, _areaStyle, _areaBodiesStyle, _buttonStyle, _titleStyle, _infoStyle;
-        private int _windowID = EngineerGlobals.GetNextWindowID();
-        private bool _hasInitStyles = false;
-        private bool _hasChanged = false;
-        private bool _isEditorLocked = false;
-
-        #endregion
-
-        #region Properties
-
-        private bool _visible = false;
-        /// <summary>
-        /// Gets and sets whether the display is enabled.
-        /// </summary>
-        public bool Visible
-        {
-            get { return _visible; }
-            set { _visible = value; }
-        }
-
-        private bool _compactMode = false;
-        /// <summary>
-        /// Gets and sets whether to show in compact mode.
-        /// </summary>
-        public bool CompactMode
-        {
-            get { return _compactMode; }
-            set { _compactMode = value; }
-        }
-
-        private bool _showAllStages = false;
-        /// <summary>
-        /// Gets and sets whether to show all stages.
-        /// </summary>
-        public bool ShowAllStages
-        {
-            get { return _showAllStages; }
-            set { _showAllStages = value; }
-        }
-
-        private bool _useAtmosphericDetails = false;
-        /// <summary>
-        /// Gets and sets whether to use atmospheric details.
-        /// </summary>
-        public bool UseAtmosphericDetails
-        {
-            get { return _useAtmosphericDetails; }
-            set { _useAtmosphericDetails = value; }
-        }
-
-        private bool _showReferenceBodies = false;
-        /// <summary>
-        /// Gets and sets whether to show the reference body selection.
-        /// </summary>
-        public bool ShowReferenceBodies
-        {
-            get { return _showReferenceBodies; }
-            set { _showReferenceBodies = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        public void Start()
-        {
-            // Set the instance to this object.
-            Instance = this;
-
-            RenderingManager.AddToPostDrawQueue(0, OnDraw);
-        }
-
-        // Initialises all of the GUI styles that are required.
-        private void InitialiseStyles()
-        {
-            _hasInitStyles = true;
-
-            _windowStyle = new GUIStyle(HighLogic.Skin.window);
-            _windowStyle.alignment = TextAnchor.UpperLeft;
-
-            _areaStyle = new GUIStyle(HighLogic.Skin.box);
-            _areaStyle.padding = new RectOffset(0, 0, 9, 0);
-
-            _areaBodiesStyle = new GUIStyle(HighLogic.Skin.box);
-
-            _buttonStyle = new GUIStyle(HighLogic.Skin.button);
-            _buttonStyle.normal.textColor = Color.white;
-            _buttonStyle.fontSize = 11;
-            _buttonStyle.fontStyle = FontStyle.Bold;
-            _buttonStyle.alignment = TextAnchor.MiddleCenter;
-
-            _titleStyle = new GUIStyle(HighLogic.Skin.label);
-            _titleStyle.normal.textColor = Color.white;
-            _titleStyle.fontSize = 11;
-            _titleStyle.fontStyle = FontStyle.Bold;
-            _titleStyle.alignment = TextAnchor.MiddleCenter;
-            _titleStyle.stretchWidth = true;
-
-            _infoStyle = new GUIStyle(HighLogic.Skin.label);
-            _infoStyle.fontSize = 11;
-            _infoStyle.fontStyle = FontStyle.Bold;
-            _infoStyle.alignment = TextAnchor.MiddleCenter;
-            _infoStyle.stretchWidth = true;
-        }
-
-        #endregion
-
-        #region Update and Drawing
-
-        public void Update()
-        {
-            try
-            {
-                if (_visible && EditorLogic.fetch != null && EditorLogic.fetch.ship.Count > 0)
-                {
-                    // Configure the simulation parameters based on the selected reference body.
-                    SimulationManager.Instance.Gravity = CelestialBodies.Instance.SelectedBodyInfo.Gravity;
-                    if (_useAtmosphericDetails)
-                        SimulationManager.Instance.Atmosphere = CelestialBodies.Instance.SelectedBodyInfo.Atmosphere * 0.01d;
-                    else
-                        SimulationManager.Instance.Atmosphere = 0d;
-
-                    SimulationManager.Instance.TryStartSimulation();
-
-                    // Reset the window size when the staging or something else has changed.
-                    if (_hasChanged || SimulationManager.Instance.StagingChanged)
-                    {
-                        _hasChanged = false;
-
-                        _windowPosition.width = 0f;
-                        _windowPosition.height = 0f;
-                    }
-                }
-            }
-            catch { /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */ }
-        }
-
-        private void OnDraw()
-        {
-            try
-            {
-                if (_visible && EditorLogic.fetch != null && EditorLogic.fetch.ship.Count > 0)
-                {
-                    SimulationManager.Instance.RequestSimulation();
-
-                    // Initialise the GUI styles, but only once as needed.
-                    if (!_hasInitStyles) InitialiseStyles();
-
-                    // Change the window title based on whether in compact mode or not.
-                    string title;
-                    if (!_compactMode)
-                        title = "KERBAL ENGINEER REDUX " + EngineerGlobals.AssemblyVersion;
-                    else
-                        title = "K.E.R. " + EngineerGlobals.AssemblyVersion;
-
-                    _windowPosition = GUILayout.Window(_windowID, _windowPosition, Window, title, _windowStyle).ClampToScreen();
-
-                    // Check editor lock to manage click-through.
-                    CheckEditorLock();
-                }
-            }
-            catch { /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */ }
-        }
-
-        // Checks whether the editor should be looked to stop click-through.
-        private void CheckEditorLock()
-        {
-            if (_windowPosition.MouseIsOver())
-            {
-                EditorLogic.fetch.State = EditorLogic.EditorState.GUI_SELECTED;
-                _isEditorLocked = true;
-            }
-            else if (!_windowPosition.MouseIsOver() && _isEditorLocked)
-            {
-                EditorLogic.fetch.State = EditorLogic.EditorState.PAD_UNSELECTED;
-                _isEditorLocked = false;
-            }
-        }
-
-        private void Window(int windowID)
-        {
-            // Draw the compact mode toggle.
-            if (GUI.Toggle(new Rect(_windowPosition.width - 70f, 5f, 65f, 20f), _compactMode, "COMPACT", _buttonStyle) != _compactMode)
-            {
-                _hasChanged = true;
-                _compactMode = !_compactMode;
-            }
-
-            // When not in compact mode draw the 'All Stages' and 'Atmospheric' toggles.
-            if (!_compactMode)
-            {
-                if (GUI.Toggle(new Rect(_windowPosition.width - 153f, 5f, 80f, 20f), _showAllStages, "ALL STAGES", _buttonStyle) != _showAllStages)
-                {
-                    _hasChanged = true;
-                    _showAllStages = !_showAllStages;
-                }
-
-                _useAtmosphericDetails = GUI.Toggle(new Rect(_windowPosition.width - 251f, 5f, 95f, 20f), _useAtmosphericDetails, "ATMOSPHERIC", _buttonStyle);
-                if (GUI.Toggle(new Rect(_windowPosition.width - 379f, 5f, 125f, 20f), _showReferenceBodies, "REFERENCE BODIES", _buttonStyle) != _showReferenceBodies)
-                {
-                    _hasChanged = true;
-                    _showReferenceBodies = !_showReferenceBodies;
-                }
-            }
-
-            // Draw the main informational display box.
-            
-            if (!_compactMode)
-            {
-                GUILayout.BeginHorizontal(_areaStyle);
-                DrawStageNumbers();
-                DrawPartCount();
-                DrawCost();
-                DrawMass();
-                DrawIsp();
-                DrawThrust();
-                DrawTWR();
-                DrawDeltaV();
-                DrawBurnTime();
-                GUILayout.EndHorizontal();
-
-                if (_showReferenceBodies)
-                {
-                    GUILayout.BeginVertical(_areaBodiesStyle);
-                    DrawReferenceBodies();
-                    GUILayout.EndVertical();
-                }
-            }
-            else // Draw only a few details when in compact mode.
-            {
-                GUILayout.BeginHorizontal(_areaStyle);
-                DrawStageNumbers();
-                DrawTWR();
-                DrawDeltaV();
-                GUILayout.EndHorizontal();
-            }
-            
-            GUI.DragWindow();
-        }
-
-        // Draws all the reference bodies.
-        private void DrawReferenceBodies()
-        {
-            int index = 0;
-            foreach (string bodyName in CelestialBodies.Instance.BodyList.Keys)
-            {
-                if (index % 8 == 0)
-                {
-                    if (index > 0) GUILayout.EndHorizontal();
-                    GUILayout.BeginHorizontal();
-                }
-                if (GUILayout.Toggle(CelestialBodies.Instance.SelectedBodyName == bodyName, bodyName, _buttonStyle))
-                {
-                    CelestialBodies.Instance.SelectedBodyName = bodyName;
-                }
-                index++;
-            }
-            GUILayout.EndHorizontal();
-        }
-
-        // Draws the stage number column.
-        private void DrawStageNumbers()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(30f));
-            GUILayout.Label("", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.Number, _titleStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the part count column.
-        private void DrawPartCount()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(50f));
-            GUILayout.Label("PARTS", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.Parts, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the cost column.
-        private void DrawCost()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(100f));
-            GUILayout.Label("COST", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.Cost, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the mass column.
-        private void DrawMass()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(100f));
-            GUILayout.Label("MASS", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.Mass, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the specific impulse column.
-        private void DrawIsp()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(50f));
-            GUILayout.Label("ISP", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.Isp, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the thrust column.
-        private void DrawThrust()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(75f));
-            GUILayout.Label("THRUST", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.Thrust, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the thrust to weight ratio column.
-        private void DrawTWR()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(50f));
-            GUILayout.Label("TWR", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.TWR, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the deltaV column.
-        private void DrawDeltaV()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(100f));
-            GUILayout.Label("DELTA-V", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.DeltaV, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        // Draws the burn time column.
-        private void DrawBurnTime()
-        {
-            GUILayout.BeginVertical(GUILayout.Width(75f));
-            GUILayout.Label("BURN", _titleStyle);
-            foreach (Stage stage in SimulationManager.Instance.Stages)
-            {
-                if (_showAllStages || stage.deltaV > 0d)
-                    GUILayout.Label(stage.Time, _infoStyle);
-            }
-            GUILayout.EndVertical();
-        }
-
-        #endregion
-
-        #region Save and Load
-
-        // Saves the settings when this object is destroyed.
-        public void OnDestroy()
-        {
-            try
-            {
-                SettingList list = new SettingList();
-                list.AddSetting("visible", _visible);
-                list.AddSetting("x", _windowPosition.x);
-                list.AddSetting("y", _windowPosition.y);
-                list.AddSetting("compact", _compactMode);
-                list.AddSetting("all_stages", _showAllStages);
-                list.AddSetting("atmosphere", _useAtmosphericDetails);
-                list.AddSetting("bodies", _showReferenceBodies);
-                list.AddSetting("selected_body", CelestialBodies.Instance.SelectedBodyName);
-                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/BuildAdvanced", list);
-
-                print("[KerbalEngineer/BuildAdvanced]: Successfully saved settings.");
-            }
-            catch { print("[KerbalEngineer/BuildAdvanced]: Failed to save settings."); }
-        }
-
-        // Loads the settings when this object is created.
-        public void Awake()
-        {
-            try
-            {
-                SettingList list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/BuildAdvanced");
-                _visible = (bool)list.GetSetting("visible", _visible);
-                _windowPosition.x = (float)list.GetSetting("x", _windowPosition.x);
-                _windowPosition.y = (float)list.GetSetting("y", _windowPosition.y);
-                _compactMode = (bool)list.GetSetting("compact", _compactMode);
-                _showAllStages = (bool)list.GetSetting("all_stages", _showAllStages);
-                _useAtmosphericDetails = (bool)list.GetSetting("atmosphere", _useAtmosphericDetails);
-                _showReferenceBodies = (bool)list.GetSetting("bodies", _showReferenceBodies);
-                CelestialBodies.Instance.SelectedBodyName = (string)list.GetSetting("selected_body", "Kerbin");
-
-                print("[KerbalEngineer/BuildAdvanced]: Successfully loaded settings.");
-            }
-            catch { print("[KerbalEngineer/BuildAdvanced]: Failed to load settings."); }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+using KerbalEngineer.Settings;

+using KerbalEngineer.Simulation;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.BuildEngineer

+{

+    [KSPAddon(KSPAddon.Startup.EditorAny, false)]

+    public class BuildAdvanced : MonoBehaviour

+    {

+        #region Instance

+

+        /// <summary>

+        ///     Gets the current instance if started or returns null.

+        /// </summary>

+        public static BuildAdvanced Instance { get; private set; }

+

+        #endregion

+

+        #region Fields

+

+        private readonly int windowId = EngineerGlobals.GetNextWindowId();

+

+        private bool hasChanged;

+        private bool isEditorLocked;

+        private Rect windowPosition = new Rect(265.0f, 45.0f, 0, 0);

+

+        #region Styles

+

+        private GUIStyle areaBodiesStyle;

+        private GUIStyle areaStyle;

+        private GUIStyle buttonStyle;

+        private GUIStyle infoStyle;

+        private GUIStyle titleStyle;

+        private GUIStyle windowStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Properties

+

+        private bool compactMode;

+        private bool showAllStages;

+        private bool showReferenceBodies;

+        private bool useAtmosphericDetails;

+        private bool visible;

+

+        /// <summary>

+        ///     Gets and sets whether the display is enabled.

+        /// </summary>

+        public bool Visible

+        {

+            get { return this.visible; }

+            set { this.visible = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether to show in compact mode.

+        /// </summary>

+        public bool CompactMode

+        {

+            get { return this.compactMode; }

+            set { this.compactMode = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether to show all stages.

+        /// </summary>

+        public bool ShowAllStages

+        {

+            get { return this.showAllStages; }

+            set { this.showAllStages = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether to use atmospheric details.

+        /// </summary>

+        public bool UseAtmosphericDetails

+        {

+            get { return this.useAtmosphericDetails; }

+            set { this.useAtmosphericDetails = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether to show the reference body selection.

+        /// </summary>

+        public bool ShowReferenceBodies

+        {

+            get { return this.showReferenceBodies; }

+            set { this.showReferenceBodies = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        private void Awake()

+        {

+            Instance = this;

+            this.Load();

+        }

+

+        private void Start()

+        {

+            this.InitialiseStyles();

+            RenderingManager.AddToPostDrawQueue(0, this.OnDraw);

+        }

+

+        /// <summary>

+        ///     Initialises all the styles that are required.

+        /// </summary>

+        private void InitialiseStyles()

+        {

+            this.areaBodiesStyle = new GUIStyle(HighLogic.Skin.box);

+

+            this.windowStyle = new GUIStyle(HighLogic.Skin.window)

+            {

+                alignment = TextAnchor.UpperLeft

+            };

+

+            this.areaStyle = new GUIStyle(HighLogic.Skin.box)

+            {

+                padding = new RectOffset(0, 0, 9, 0)

+            };

+

+            this.buttonStyle = new GUIStyle(HighLogic.Skin.button)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                alignment = TextAnchor.MiddleCenter

+            };

+

+            this.titleStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                alignment = TextAnchor.MiddleCenter,

+                stretchWidth = true

+            };

+

+            this.infoStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                alignment = TextAnchor.MiddleCenter,

+                stretchWidth = true

+            };

+        }

+

+        #endregion

+

+        #region Update and Drawing

+

+        private void Update()

+        {

+            try

+            {

+                if (!this.visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.Count <= 0)

+                {

+                    return;

+                }

+

+                // Configure the simulation parameters based on the selected reference body.

+                SimulationManager.Instance.Gravity = CelestialBodies.Instance.SelectedBodyInfo.Gravity;

+                if (this.useAtmosphericDetails)

+                {

+                    SimulationManager.Instance.Atmosphere = CelestialBodies.Instance.SelectedBodyInfo.Atmosphere *

+                                                            0.01d;

+                }

+                else

+                {

+                    SimulationManager.Instance.Atmosphere = 0;

+                }

+

+                SimulationManager.Instance.TryStartSimulation();

+

+                // Reset the window size when the staging or something else has changed.

+                if (this.hasChanged || SimulationManager.Instance.StagingChanged)

+                {

+                    this.hasChanged = false;

+

+                    this.windowPosition.width = 0;

+                    this.windowPosition.height = 0;

+                }

+            }

+            catch

+            {

+                /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */

+            }

+        }

+

+        private void OnDraw()

+        {

+            try

+            {

+                if (!this.visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.Count <= 0)

+                {

+                    return;

+                }

+

+                SimulationManager.Instance.RequestSimulation();

+

+                // Change the window title based on whether in compact mode or not.

+                string title;

+                if (!this.compactMode)

+                {

+                    title = "KERBAL ENGINEER REDUX " + EngineerGlobals.AssemblyVersion;

+                }

+                else

+                {

+                    title = "K.E.R. " + EngineerGlobals.AssemblyVersion;

+                }

+

+                this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, title, this.windowStyle).ClampToScreen();

+

+                // Check editor lock to manage click-through.

+                this.CheckEditorLock();

+            }

+            catch

+            {

+                /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */

+            }

+        }

+

+        /// <summary>

+        ///     Checks whether the editor should be locked to stop click-through.

+        /// </summary>

+        private void CheckEditorLock()

+        {

+            if (this.windowPosition.MouseIsOver())

+            {

+                EditorLogic.fetch.State = EditorLogic.EditorState.GUI_SELECTED;

+                this.isEditorLocked = true;

+            }

+            else if (!this.windowPosition.MouseIsOver() && this.isEditorLocked)

+            {

+                EditorLogic.fetch.State = EditorLogic.EditorState.PAD_UNSELECTED;

+                this.isEditorLocked = false;

+            }

+        }

+

+        /// <summary>

+        ///     Draws the OnGUI window.

+        /// </summary>

+        private void Window(int windowId)

+        {

+            // Draw the compact mode toggle.

+            if (GUI.Toggle(new Rect(this.windowPosition.width - 70.0f, 5.0f, 65.0f, 20.0f), this.compactMode, "COMPACT", this.buttonStyle) != this.compactMode)

+            {

+                this.hasChanged = true;

+                this.compactMode = !this.compactMode;

+            }

+

+            // When not in compact mode draw the 'All Stages' and 'Atmospheric' toggles.

+            if (!this.compactMode)

+            {

+                if (GUI.Toggle(new Rect(this.windowPosition.width - 153.0f, 5.0f, 80.0f, 20.0f), this.showAllStages, "ALL STAGES", this.buttonStyle) != this.showAllStages)

+                {

+                    this.hasChanged = true;

+                    this.showAllStages = !this.showAllStages;

+                }

+

+                this.useAtmosphericDetails = GUI.Toggle(new Rect(this.windowPosition.width - 251.0f, 5.0f, 95.0f, 20.0f), this.useAtmosphericDetails, "ATMOSPHERIC", this.buttonStyle);

+

+                if (GUI.Toggle(new Rect(this.windowPosition.width - 379.0f, 5.0f, 125.0f, 20.0f), this.showReferenceBodies, "REFERENCE BODIES", this.buttonStyle) != this.showReferenceBodies)

+                {

+                    this.hasChanged = true;

+                    this.showReferenceBodies = !this.showReferenceBodies;

+                }

+            }

+

+            // Draw the main informational display box.

+

+            if (!this.compactMode)

+            {

+                GUILayout.BeginHorizontal(this.areaStyle);

+                this.DrawStageNumbers();

+                this.DrawPartCount();

+                this.DrawCost();

+                this.DrawMass();

+                this.DrawIsp();

+                this.DrawThrust();

+                this.DrawTwr();

+                this.DrawDeltaV();

+                this.DrawBurnTime();

+                GUILayout.EndHorizontal();

+

+                if (this.showReferenceBodies)

+                {

+                    GUILayout.BeginVertical(this.areaBodiesStyle);

+                    this.DrawReferenceBodies();

+                    GUILayout.EndVertical();

+                }

+            }

+            else // Draw only a few details when in compact mode.

+            {

+                GUILayout.BeginHorizontal(this.areaStyle);

+                this.DrawStageNumbers();

+                this.DrawTwr();

+                this.DrawDeltaV();

+                GUILayout.EndHorizontal();

+            }

+

+            GUI.DragWindow();

+        }

+

+        /// <summary>

+        ///     Draws all the reference bodies.

+        /// </summary>

+        private void DrawReferenceBodies()

+        {

+            var index = 0;

+

+            foreach (var bodyName in CelestialBodies.Instance.BodyList.Keys)

+            {

+                if (index % 8 == 0)

+                {

+                    if (index > 0)

+                    {

+                        GUILayout.EndHorizontal();

+                    }

+                    GUILayout.BeginHorizontal();

+                }

+                if (GUILayout.Toggle(CelestialBodies.Instance.SelectedBodyName == bodyName, bodyName, this.buttonStyle))

+                {

+                    CelestialBodies.Instance.SelectedBodyName = bodyName;

+                }

+                index++;

+            }

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws the stage number column.

+        /// </summary>

+        private void DrawStageNumbers()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(30.0f));

+            GUILayout.Label("", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.Number, this.titleStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Draws the part count column.

+        /// </summary>

+        private void DrawPartCount()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(50.0f));

+            GUILayout.Label("PARTS", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.Parts, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Draws the cost column.

+        /// </summary>

+        private void DrawCost()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(100.0f));

+            GUILayout.Label("COST", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.Cost, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Draws the mass column.

+        /// </summary>

+        private void DrawMass()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(100.0f));

+            GUILayout.Label("MASS", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.Mass, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Draws the specific impluse column.

+        /// </summary>

+        private void DrawIsp()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(50.0f));

+            GUILayout.Label("ISP", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.Isp, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Draws the thrust column.

+        /// </summary>

+        private void DrawThrust()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(75.0f));

+            GUILayout.Label("THRUST", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.Thrust, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Drwas the thrust to weight ratio column.

+        /// </summary>

+        private void DrawTwr()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(50.0f));

+            GUILayout.Label("TWR", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.TWR, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Draws the deltaV column.

+        /// </summary>

+        private void DrawDeltaV()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(100.0f));

+            GUILayout.Label("DELTA-V", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.DeltaV, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        /// <summary>

+        ///     Draws the burn time column.

+        /// </summary>

+        private void DrawBurnTime()

+        {

+            GUILayout.BeginVertical(GUILayout.Width(75.0f));

+            GUILayout.Label("BURN", this.titleStyle);

+            foreach (var stage in SimulationManager.Instance.Stages)

+            {

+                if (this.showAllStages || stage.deltaV > 0)

+                {

+                    GUILayout.Label(stage.Time, this.infoStyle);

+                }

+            }

+            GUILayout.EndVertical();

+        }

+

+        #endregion

+

+        #region Save and Load

+

+        /// <summary>

+        ///     Saves the settings when this object is destroyed.

+        /// </summary>

+        private void OnDestroy()

+        {

+            try

+            {

+                var list = new SettingList();

+                list.AddSetting("visible", this.visible);

+                list.AddSetting("x", this.windowPosition.x);

+                list.AddSetting("y", this.windowPosition.y);

+                list.AddSetting("compact", this.compactMode);

+                list.AddSetting("all_stages", this.showAllStages);

+                list.AddSetting("atmosphere", this.useAtmosphericDetails);

+                list.AddSetting("bodies", this.showReferenceBodies);

+                list.AddSetting("selected_body", CelestialBodies.Instance.SelectedBodyName);

+                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/BuildAdvanced", list);

+

+                print("[KerbalEngineer/BuildAdvanced]: Successfully saved settings.");

+            }

+            catch

+            {

+                print("[KerbalEngineer/BuildAdvanced]: Failed to save settings.");

+            }

+        }

+

+        /// <summary>

+        ///     Loads the settings when this object is created.

+        /// </summary>

+        private void Load()

+        {

+            try

+            {

+                var list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/BuildAdvanced");

+                this.visible = (bool)list.GetSetting("visible", this.visible);

+                this.windowPosition.x = (float)list.GetSetting("x", this.windowPosition.x);

+                this.windowPosition.y = (float)list.GetSetting("y", this.windowPosition.y);

+                this.compactMode = (bool)list.GetSetting("compact", this.compactMode);

+                this.showAllStages = (bool)list.GetSetting("all_stages", this.showAllStages);

+                this.useAtmosphericDetails = (bool)list.GetSetting("atmosphere", this.useAtmosphericDetails);

+                this.showReferenceBodies = (bool)list.GetSetting("bodies", this.showReferenceBodies);

+                CelestialBodies.Instance.SelectedBodyName = (string)list.GetSetting("selected_body", "Kerbin");

+

+                print("[KerbalEngineer/BuildAdvanced]: Successfully loaded settings.");

+            }

+            catch

+            {

+                print("[KerbalEngineer/BuildAdvanced]: Failed to load settings.");

+            }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/BuildEngineer/BuildButton.cs
+++ b/KerbalEngineer/BuildEngineer/BuildButton.cs
@@ -1,152 +1,188 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.IO;
-using UnityEngine;
-
-namespace KerbalEngineer.BuildEngineer
-{
-    [KSPAddon(KSPAddon.Startup.EditorAny, false)]
-    public class BuildButton : MonoBehaviour
-    {
-        #region Fields
-
-        private Rect _position = new Rect(Screen.width / 2f - 300f, 0f, 50f, 45f);
-        private GUIStyle _tooltipTitleStyle, _tooltipInfoStyle;
-        private Texture2D _normal = new Texture2D(50, 45, TextureFormat.RGBA32, false);
-        private Texture2D _hover = new Texture2D(50, 45, TextureFormat.RGBA32, false);
-        private Texture2D _down = new Texture2D(50, 45, TextureFormat.RGBA32, false);
-        private Texture2D _locked = new Texture2D(50, 45, TextureFormat.RGBA32, false);
-
-        private bool _clicked = false;
-        private bool _hasInitStyles = false;
-
-        #endregion
-
-        #region Initialisation
-
-        public void Start()
-        {
-            // Load the button textures directly from the PNG files. (Would of used GameDatabase but it compresses them so it looks shit!)
-            _normal.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Normal.png"));
-            _hover.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Hover.png"));
-            _down.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Down.png"));
-            _locked.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Locked.png"));
-
-            RenderingManager.AddToPostDrawQueue(0, OnDraw);
-        }
-
-        // Initialises all of the GUI styles that are required.
-        private void InitialiseStyles()
-        {
-            _tooltipTitleStyle = new GUIStyle(HighLogic.Skin.label);
-            _tooltipTitleStyle.normal.textColor = Color.white;
-            _tooltipTitleStyle.fontSize = 13;
-            _tooltipTitleStyle.fontStyle = FontStyle.Bold;
-
-            _tooltipInfoStyle = new GUIStyle(HighLogic.Skin.label);
-            _tooltipInfoStyle.fontSize = 11;
-            _tooltipInfoStyle.fontStyle = FontStyle.Bold;
-        }
-
-        #endregion
-
-        #region Update and Drawing
-
-        private void Update()
-        {
-            if (Input.GetKeyDown(KeyCode.Backslash))
-            {
-                ButtonClickedLeft();
-            }
-        }
-
-        private void OnDraw()
-        {
-            if (!_hasInitStyles) InitialiseStyles();
-
-            if (EditorLogic.fetch.ship.Count > 0)
-            {
-                if (_clicked) // Button has been clicked whilst being hovered.
-                {
-                    GUI.DrawTexture(_position, _down);
-
-                    if (_position.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.
-                    {
-                        DrawToolTip();
-
-                        if (Mouse.Left.GetButtonUp()) // The mouse up event has been triggered whilst over the button.
-                        {
-                            _clicked = false;
-                            ButtonClickedLeft();
-                        }
-                        else if (Mouse.Right.GetButtonUp())
-                        {
-                            _clicked = false;
-                            ButtonClickedRight();
-                        }
-                    }
-                }
-                else // The button is not registering as being clicked.
-                {
-                    if (_position.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.
-                    {
-                        // If the left mouse button has just been pressed, see the button as being clicked.
-                        if (!_clicked && (Mouse.Left.GetButtonDown() || Mouse.Right.GetButtonDown())) _clicked = true;
-
-                        if (_clicked) // The button has just been clicked.
-                        {
-                            GUI.DrawTexture(_position, _down);
-                        }
-                        else if (!Mouse.Left.GetButton() && !Mouse.Right.GetButton()) // Mouse button is not down and is just hovering.
-                        {
-                            GUI.DrawTexture(_position, _hover);
-                            DrawToolTip();
-                        }
-                        else // Mouse button is down but no click was registered over the button.
-                        {
-                            GUI.DrawTexture(_position, _normal);
-                        }
-                    }
-                    else // The mouse is not being hovered.
-                    {
-                        GUI.DrawTexture(_position, _normal);
-                    }
-                }
-
-                // Check for an unclick event whilst the mouse is not hovering.
-                if (_clicked && (Mouse.Left.GetButtonUp() || Mouse.Right.GetButtonUp())) _clicked = false;
-            }
-            else // The editor is set as being locked.
-            {
-                GUI.DrawTexture(_position, _locked);
-            }
-        }
-
-        // Draws the tooltip next to the mouse cursor.
-        private void DrawToolTip()
-        {
-            GUI.Label(new Rect(Event.current.mousePosition.x + 16f, Event.current.mousePosition.y, 500f, 25f), "Kerbal Engineer Redux", _tooltipTitleStyle);
-            GUI.Label(new Rect(Event.current.mousePosition.x + 16f, Event.current.mousePosition.y + 16f, 500f, 25f), "[Left Click / Backslash] Advanced - [Right Click] Overlay", _tooltipInfoStyle);
-            //GUI.Label(new Rect(Event.current.mousePosition.x + 16f, Event.current.mousePosition.y + 30f, 256f, 25f), "", _tooltipInfoStyle);
-        }
-
-        // Runs the stuff to do when the button is clicked with the left mouse button.
-        private void ButtonClickedLeft()
-        {
-            if (BuildAdvanced.Instance != null)
-                BuildAdvanced.Instance.Visible = !BuildAdvanced.Instance.Visible;
-        }
-
-        // Runs the stuff to do when the button is clicked with the right mouse button.
-        private void ButtonClickedRight()
-        {
-            if (BuildOverlay.Instance != null)
-                BuildOverlay.Instance.Visible = !BuildOverlay.Instance.Visible;
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.IO;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.BuildEngineer

+{

+    [KSPAddon(KSPAddon.Startup.EditorAny, false)]

+    public class BuildButton : MonoBehaviour

+    {

+        #region Fields

+

+        private readonly Texture2D down = new Texture2D(50, 45, TextureFormat.RGBA32, false);

+        private readonly Texture2D hover = new Texture2D(50, 45, TextureFormat.RGBA32, false);

+        private readonly Texture2D locked = new Texture2D(50, 45, TextureFormat.RGBA32, false);

+        private readonly Texture2D normal = new Texture2D(50, 45, TextureFormat.RGBA32, false);

+

+        private bool clicked;

+        private Rect position = new Rect(Screen.width * 0.5f - 300.0f, 0, 50.0f, 45.0f);

+

+        #region Styles

+

+        private GUIStyle tooltipInfoStyle;

+        private GUIStyle tooltipTitleStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Initialisation

+

+        private void Start()

+        {

+            // Load the button textures directly from the PNG files. (Would of used GameDatabase but it compresses them so it looks shit!)

+            this.normal.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Normal.png"));

+            this.hover.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Hover.png"));

+            this.down.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Down.png"));

+            this.locked.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/BuildButton/Locked.png"));

+

+            this.InitialiseStyles();

+            RenderingManager.AddToPostDrawQueue(0, this.OnDraw);

+        }

+

+        /// <summary>

+        ///     Initialises all of the GUI styles that are required.

+        /// </summary>

+        private void InitialiseStyles()

+        {

+            this.tooltipTitleStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 13,

+                fontStyle = FontStyle.Bold

+            };

+

+            this.tooltipInfoStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                fontSize = 11,

+                fontStyle = FontStyle.Bold

+            };

+        }

+

+        #endregion

+

+        #region Update and Drawing

+

+        private void Update()

+        {

+            if (Input.GetKeyDown(KeyCode.Backslash))

+            {

+                LeftClick();

+            }

+        }

+

+        private void OnDraw()

+        {

+            if (EditorLogic.fetch.ship.Count > 0)

+            {

+                if (this.clicked) // Button has been clicked whilst being hovered.

+                {

+                    GUI.DrawTexture(this.position, this.down);

+

+                    if (this.position.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.

+                    {

+                        this.DrawToolTip();

+

+                        if (Mouse.Left.GetButtonUp()) // The mouse up event has been triggered whilst over the button.

+                        {

+                            this.clicked = false;

+                            LeftClick();

+                        }

+                        else if (Mouse.Right.GetButtonUp())

+                        {

+                            this.clicked = false;

+                            RightClick();

+                        }

+                    }

+                }

+                else // The button is not registering as being clicked.

+                {

+                    if (this.position.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.

+                    {

+                        // If the left mouse button has just been pressed, see the button as being clicked.

+                        if (!this.clicked && (Mouse.Left.GetButtonDown() || Mouse.Right.GetButtonDown()))

+                        {

+                            this.clicked = true;

+                        }

+

+                        if (this.clicked) // The button has just been clicked.

+                        {

+                            GUI.DrawTexture(this.position, this.down);

+                        }

+                        else if (!Mouse.Left.GetButton() && !Mouse.Right.GetButton()) // Mouse button is not down and is just hovering.

+                        {

+                            GUI.DrawTexture(this.position, this.hover);

+                            this.DrawToolTip();

+                        }

+                        else // Mouse button is down but no click was registered over the button.

+                        {

+                            GUI.DrawTexture(this.position, this.normal);

+                        }

+                    }

+                    else // The mouse is not being hovered.

+                    {

+                        GUI.DrawTexture(this.position, this.normal);

+                    }

+                }

+

+                // Check for an unclick event whilst the mouse is not hovering.

+                if (this.clicked && (Mouse.Left.GetButtonUp() || Mouse.Right.GetButtonUp()))

+                {

+                    this.clicked = false;

+                }

+            }

+            else // The editor is set as being locked.

+            {

+                GUI.DrawTexture(this.position, this.locked);

+            }

+        }

+

+        /// <summary>

+        ///     Draws the tooltop next to the mouse cursor.

+        /// </summary>

+        private void DrawToolTip()

+        {

+            GUI.Label(new Rect(Event.current.mousePosition.x + 16.0f, Event.current.mousePosition.y, 500.0f, 25.0f), "Kerbal Engineer Redux", this.tooltipTitleStyle);

+            GUI.Label(new Rect(Event.current.mousePosition.x + 16.0f, Event.current.mousePosition.y + 16.0f, 500.0f, 25.0f), "[Left Click / Backslash] Advanced - [Right Click] Overlay", this.tooltipInfoStyle);

+        }

+

+        #endregion

+

+        #region Static Methods

+

+        /// <summary>

+        ///     Runs when the button is clicked with the left mouse button.

+        /// </summary>

+        public static void LeftClick()

+        {

+            if (BuildAdvanced.Instance != null)

+            {

+                BuildAdvanced.Instance.Visible = !BuildAdvanced.Instance.Visible;

+            }

+        }

+

+        /// <summary>

+        ///     Runs when the button is clicked with the right mouse button.

+        /// </summary>

+        private static void RightClick()

+        {

+            if (BuildOverlay.Instance != null)

+            {

+                BuildOverlay.Instance.Visible = !BuildOverlay.Instance.Visible;

+            }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/BuildEngineer/BuildOverlay.cs
+++ b/KerbalEngineer/BuildEngineer/BuildOverlay.cs
@@ -1,354 +1,442 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.Collections.Generic;
-using System.Diagnostics;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Settings;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.BuildEngineer
-{
-    [KSPAddon(KSPAddon.Startup.EditorAny, false)]
-    public class BuildOverlay : MonoBehaviour
-    {
-        #region Instance
-
-        /// <summary>
-        /// Gets the current instance if started or returns null.
-        /// </summary>
-        public static BuildOverlay Instance { get; private set; }
-
-        #endregion
-
-        #region Fields
-
-        private Rect _windowPosition = new Rect(265f, 0f, 0f, 0f);
-        private GUIStyle _windowStyle, _titleStyle, _infoStyle, _tooltipTitleStyle, _tooltipInfoStyle;
-        private int _windowID = EngineerGlobals.GetNextWindowID();
-        private bool _hasInitStyles = false;
-
-        private Part _selectedPart = null;
-        private Stopwatch _tooltipInfoTimer = new Stopwatch();
-        private double _tooltipInfoDelay = 0.5d;
-
-        #endregion
-
-        #region Properties
-
-        private bool _visible = false;
-        /// <summary>
-        /// Gets and sets whether the display is enabled.
-        /// </summary>
-        public bool Visible
-        {
-            get { return _visible; }
-            set { _visible = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        public void Start()
-        {
-            // Set the instance to this object.
-            Instance = this;
-
-            RenderingManager.AddToPostDrawQueue(0, OnDraw);
-        }
-
-        private void InitialiseStyles()
-        {
-            _hasInitStyles = true;
-
-            _windowStyle = new GUIStyle(GUIStyle.none);
-            _windowStyle.margin = new RectOffset();
-            _windowStyle.padding = new RectOffset();
-
-            _titleStyle = new GUIStyle(HighLogic.Skin.label);
-            _titleStyle.normal.textColor = Color.white;
-            _titleStyle.margin = new RectOffset();
-            _titleStyle.padding = new RectOffset();
-            _titleStyle.fontSize = 11;
-            _titleStyle.fontStyle = FontStyle.Bold;
-            _titleStyle.stretchWidth = true;
-
-            _infoStyle = new GUIStyle(HighLogic.Skin.label);
-            _infoStyle.margin = new RectOffset();
-            _infoStyle.padding = new RectOffset();
-            _infoStyle.fontSize = 11;
-            _infoStyle.fontStyle = FontStyle.Bold;
-            _infoStyle.stretchWidth = true;
-
-            _tooltipTitleStyle = new GUIStyle(HighLogic.Skin.label);
-            _tooltipTitleStyle.normal.textColor = Color.white;
-            _tooltipTitleStyle.fontSize = 11;
-            _tooltipTitleStyle.fontStyle = FontStyle.Bold;
-            _tooltipTitleStyle.stretchWidth = true;
-
-            _tooltipInfoStyle = new GUIStyle(HighLogic.Skin.label);
-            _tooltipInfoStyle.fontSize = 11;
-            _tooltipInfoStyle.fontStyle = FontStyle.Bold;
-            _tooltipInfoStyle.stretchWidth = true;
-        }
-
-        #endregion
-
-        #region Update and Drawing
-
-        public void Update()
-        {
-            try
-            {
-                if (EditorLogic.fetch != null && EditorLogic.SortedShipList.Count > 0)
-                {
-                    // Configure the simulation parameters based on the selected reference body.
-                    SimulationManager.Instance.Gravity = CelestialBodies.Instance.SelectedBodyInfo.Gravity;
-
-                    if (BuildAdvanced.Instance.UseAtmosphericDetails)
-                        SimulationManager.Instance.Atmosphere = CelestialBodies.Instance.SelectedBodyInfo.Atmosphere * 0.01d;
-                    else
-                        SimulationManager.Instance.Atmosphere = 0d;
-
-                    SimulationManager.Instance.TryStartSimulation();
-                }
-            } catch { /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */ }
-        }
-
-        private void OnDraw()
-        {
-            try
-            {
-                if (_visible && EditorLogic.fetch != null && EditorLogic.SortedShipList.Count > 0 && EditorLogic.fetch.editorScreen == EditorLogic.EditorScreen.Parts)
-                {
-                    SimulationManager.Instance.RequestSimulation();
-
-                    // Initialise the GUI styles, but only once as needed.
-                    if (!_hasInitStyles) InitialiseStyles();
-
-                    _windowPosition = GUILayout.Window(_windowID, _windowPosition, Window, string.Empty, _windowStyle);
-
-                    // Check and set that the window is at the bottom of the screen.
-                    if (_windowPosition.y + _windowPosition.height != Screen.height - 5f)
-                        _windowPosition.y = Screen.height - _windowPosition.height - 5f;
-
-                    // Find if a part is selected or being hovered over.
-                    if (EditorLogic.SelectedPart != null)
-                    {
-                        // Do not allow the extended information to be shown.
-                        if (_selectedPart != null)
-                        {
-                            _selectedPart = null;
-                            _tooltipInfoTimer.Reset();
-                        }
-
-                        DrawTooltip(EditorLogic.SelectedPart);
-                    }
-                    else
-                    {
-                        bool isPartSelected = false;
-                        foreach (Part part in EditorLogic.SortedShipList)
-                        { 
-                            if (part.stackIcon.highlightIcon)
-                            {
-                                // Start the extended information timer.
-                                if (part != _selectedPart)
-                                {
-                                    _selectedPart = part;
-                                    _tooltipInfoTimer.Reset();
-                                    _tooltipInfoTimer.Start();
-                                }
-                                isPartSelected = true;
-
-                                DrawTooltip(part);
-                                break;
-                            }
-                        }
-
-                        // If no part is being hovered over we must reset the extended information timer.
-                        if (!isPartSelected)
-                        {
-                            if (_selectedPart != null)
-                            {
-                                _selectedPart = null;
-                                _tooltipInfoTimer.Reset();
-                            }
-                        }
-                    }
-                }
-            }
-            catch { /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */ }
-        }
-
-        private void Window(int windowID)
-        {
-            GUILayout.BeginHorizontal();
-
-            // Titles
-            GUILayout.BeginVertical(GUILayout.Width(75f));
-            GUILayout.Label("Parts:", _titleStyle);
-            GUILayout.Label("Delta-V:", _titleStyle);
-            GUILayout.Label("TWR:", _titleStyle);
-            GUILayout.EndVertical();
-
-            // Details
-            GUILayout.BeginVertical(GUILayout.Width(100f));
-            GUILayout.Label(SimulationManager.Instance.LastStage.partCount.ToString(), _infoStyle);
-            GUILayout.Label(SimulationManager.Instance.LastStage.totalDeltaV.ToString("#,0.") + " m/s", _infoStyle);
-            GUILayout.Label(SimulationManager.Instance.LastStage.TWR, _infoStyle);
-            GUILayout.EndVertical();
-
-            GUILayout.EndHorizontal();
-        }
-
-        // Draws the tooltip details of the selected/highlighted part.
-        private void DrawTooltip(Part part)
-        {
-            // Tooltip title (name of part).
-            GUIContent content = new GUIContent(part.partInfo.title);
-            Vector2 size = _tooltipTitleStyle.CalcSize(content);
-            Rect position = new Rect(Event.current.mousePosition.x + 16f, Event.current.mousePosition.y, size.x, size.y).ClampInsideScreen();
-            if (position.x < Event.current.mousePosition.x + 16f) position.y += 16f;
-            GUI.Label(position, content, _tooltipTitleStyle);
-
-            // After hovering for a period of time, show extended information.
-            if (_tooltipInfoTimer.Elapsed.TotalSeconds >= _tooltipInfoDelay)
-            {
-                // Stop the timer as it is no longer needed.
-                if (_tooltipInfoTimer.IsRunning)
-                    _tooltipInfoTimer.Stop();
-
-                // Show the dry mass of the part if applicable.
-                if (part.physicalSignificance == Part.PhysicalSignificance.FULL)
-                    DrawTooltipInfo(ref position, "Dry Mass: " + part.GetDryMass().ToMass());
-
-                // Show resources contained within the part.
-                if (part.ContainsResources())
-                {
-                    // Show the wet mass of the part if applicable.
-                    if (part.GetResourceMass() > 0f)
-                        DrawTooltipInfo(ref position, "Wet Mass: " + part.GetWetMass().ToMass());
-
-                    // List all the resources contained within the part.
-                    foreach (PartResource resource in part.Resources)
-                    {
-                        double density = resource.GetDensity();
-                        if (density > 0d)
-                            DrawTooltipInfo(ref position, resource.info.name + ": " + resource.GetMass().ToMass() + " (" + resource.amount + ")");
-                        else
-                            DrawTooltipInfo(ref position, resource.info.name + ": " + resource.amount);
-                    }
-                }
-
-                // Show details for engines.
-                if (part.IsEngine())
-                {
-                    DrawTooltipInfo(ref position, "Maximum Thrust: " + part.GetMaxThrust().ToForce());
-                    DrawTooltipInfo(ref position, "Specific Impulse: " + part.GetSpecificImpulse(1f) + " / " + part.GetSpecificImpulse(0f) + "s");
-
-                    // Thrust vectoring.
-                    if (part.HasModule("ModuleGimbal"))
-                        DrawTooltipInfo(ref position, "Thrust Vectoring Enabled");
-
-                    // Contains alternator.
-                    if (part.HasModule("ModuleAlternator"))
-                        DrawTooltipInfo(ref position, "Contains Alternator");
-                }
-
-                // Show details for RCS.
-                if (part.IsRCSModule())
-                {
-                    ModuleRCS moduleRCS = part.GetModuleRCS();
-                    DrawTooltipInfo(ref position, "Thrust Power: " + moduleRCS.thrusterPower.ToDouble().ToForce());
-                    DrawTooltipInfo(ref position, "Specific Impulse: " + moduleRCS.atmosphereCurve.Evaluate(1f) + " / " + moduleRCS.atmosphereCurve.Evaluate(0f) + "s");
-                }
-
-                // Show details for solar panels.
-                if (part.IsSolarPanel())
-                {
-                    ModuleDeployableSolarPanel module = part.GetModuleDeployableSolarPanel();
-                    DrawTooltipInfo(ref position, "Charge Rate: " + module.chargeRate.ToDouble().ToRate());
-                }
-
-                // Show details for generators.
-                if (part.IsGenerator())
-                {
-                    foreach (ModuleGenerator.GeneratorResource resource in part.GetModuleGenerator().inputList)
-                        DrawTooltipInfo(ref position, "Input: " + resource.name + " (" + resource.rate.ToDouble().ToRate() + ")");
-
-                    foreach (ModuleGenerator.GeneratorResource resource in part.GetModuleGenerator().outputList)
-                        DrawTooltipInfo(ref position, "Output: " + resource.name + " (" + resource.rate.ToDouble().ToRate() + ")");
-                }
-
-                // Show details for parachutes.
-                if (part.IsParachute())
-                {
-                    ModuleParachute module = part.GetModuleParachute();
-                    DrawTooltipInfo(ref position, "Semi Deployed Drag: " + module.semiDeployedDrag);
-                    DrawTooltipInfo(ref position, "Fully Deployed Drag: " + module.fullyDeployedDrag);
-                    DrawTooltipInfo(ref position, "Deployment Altitude: " + module.deployAltitude.ToDouble().ToDistance());
-                }
-
-                // Contains stability augmentation system.
-                if (part.HasModule("ModuleSAS"))
-                    DrawTooltipInfo(ref position, "Contains SAS");
-
-                // Contains reaction wheels.
-                if (part.HasModule("ModuleReactionWheel"))
-                    DrawTooltipInfo(ref position, "Contains Reaction Wheels");
-
-                // Show if the part has an animation that can only be used once.
-                if (part.HasOneShotAnimation())
-                    DrawTooltipInfo(ref position, "Single Activation Only");
-            }
-        }
-
-        // Draws a line of extended information below the previous.
-        private void DrawTooltipInfo(ref Rect position, string value)
-        {
-            GUIContent content = new GUIContent(value);
-            Vector2 size = _tooltipInfoStyle.CalcSize(content);
-            position.y += 16f;
-            position.width = size.x;
-            position.height = size.y;
-            GUI.Label(position, content, _tooltipInfoStyle);
-        }
-
-        #endregion
-
-        #region Save and Load
-
-        // Saves the settings when this object is destroyed.
-        public void OnDestroy()
-        {
-            try
-            {
-                SettingList list = new SettingList();
-                list.AddSetting("visible", _visible);
-                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/BuildOverlay", list);
-
-                print("[KerbalEngineer/BuildOverlay]: Successfully saved settings.");
-            }
-            catch { print("[KerbalEngineer/BuildOverlay]: Failed to save settings."); }
-        }
-
-        // loads the settings when this object is created.
-        public void Awake()
-        {
-            try
-            {
-                SettingList list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/BuildOverlay");
-                _visible = (bool)list.GetSetting("visible", _visible);
-
-                print("[KerbalEngineer/BuildOverlay]: Successfully loaded settings.");
-            }
-            catch { print("[KerbalEngineer/BuildOverlay]: Failed to load settigns."); }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.Diagnostics;

+

+using KerbalEngineer.Extensions;

+using KerbalEngineer.Settings;

+using KerbalEngineer.Simulation;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.BuildEngineer

+{

+    [KSPAddon(KSPAddon.Startup.EditorAny, false)]

+    public class BuildOverlay : MonoBehaviour

+    {

+        #region Instance

+

+        /// <summary>

+        ///     Gets the current instance if started or returns null.

+        /// </summary>

+        public static BuildOverlay Instance { get; private set; }

+

+        #endregion

+

+        #region Fields

+

+        private readonly Stopwatch tooltipInfoTimer = new Stopwatch();

+        private readonly int windowId = EngineerGlobals.GetNextWindowId();

+        private Part selectedPart;

+        private Rect windowPosition = new Rect(265.0f, 0, 0, 0);

+

+        #region Styles

+

+        private GUIStyle infoStyle;

+        private GUIStyle titleStyle;

+        private GUIStyle tooltipInfoStyle;

+        private GUIStyle tooltipTitleStyle;

+        private GUIStyle windowStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Properties

+

+        private float tooltipInfoDelay = 0.5f;

+        private bool visible;

+

+        public float TooltipInfoDelay

+        {

+            get { return this.tooltipInfoDelay; }

+            set { this.tooltipInfoDelay = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether the display is enabled.

+        /// </summary>

+        public bool Visible

+        {

+            get { return this.visible; }

+            set { this.visible = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        private void Awake()

+        {

+            Instance = this;

+            this.Load();

+        }

+

+        private void Start()

+        {

+            this.InitialiseStyles();

+            RenderingManager.AddToPostDrawQueue(0, this.OnDraw);

+        }

+

+        private void InitialiseStyles()

+        {

+            this.windowStyle = new GUIStyle(GUIStyle.none)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset()

+            };

+

+            this.titleStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                margin = new RectOffset(),

+                padding = new RectOffset(),

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+

+            this.infoStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset(),

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+

+            this.tooltipTitleStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+

+            this.tooltipInfoStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+        }

+

+        #endregion

+

+        #region Update and Drawing

+

+        private void Update()

+        {

+            try

+            {

+                if (EditorLogic.fetch == null || EditorLogic.SortedShipList.Count <= 0)

+                {

+                    return;

+                }

+

+                // Configure the simulation parameters based on the selected reference body.

+                SimulationManager.Instance.Gravity = CelestialBodies.Instance.SelectedBodyInfo.Gravity;

+

+                if (BuildAdvanced.Instance.UseAtmosphericDetails)

+                {

+                    SimulationManager.Instance.Atmosphere = CelestialBodies.Instance.SelectedBodyInfo.Atmosphere * 0.01d;

+                }

+                else

+                {

+                    SimulationManager.Instance.Atmosphere = 0;

+                }

+

+                SimulationManager.Instance.TryStartSimulation();

+            }

+            catch

+            {

+                /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */

+            }

+        }

+

+        private void OnDraw()

+        {

+            try

+            {

+                if (!this.visible || EditorLogic.fetch == null || EditorLogic.SortedShipList.Count <= 0 || EditorLogic.fetch.editorScreen != EditorLogic.EditorScreen.Parts)

+                {

+                    return;

+                }

+

+                SimulationManager.Instance.RequestSimulation();

+

+                this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, string.Empty, this.windowStyle);

+

+                // Check and set that the window is at the bottom of the screen.

+                if (this.windowPosition.y + this.windowPosition.height != Screen.height - 5.0f)

+                {

+                    this.windowPosition.y = Screen.height - this.windowPosition.height - 5.0f;

+                }

+

+                // Find if a part is selected or being hovered over.

+                if (EditorLogic.SelectedPart != null)

+                {

+                    // Do not allow the extended information to be shown.

+                    if (this.selectedPart != null)

+                    {

+                        this.selectedPart = null;

+                        this.tooltipInfoTimer.Reset();

+                    }

+

+                    this.DrawTooltip(EditorLogic.SelectedPart);

+                }

+                else

+                {

+                    var isPartSelected = false;

+                    foreach (var part in EditorLogic.SortedShipList)

+                    {

+                        if (part.stackIcon.highlightIcon)

+                        {

+                            // Start the extended information timer.

+                            if (part != this.selectedPart)

+                            {

+                                this.selectedPart = part;

+                                this.tooltipInfoTimer.Reset();

+                                this.tooltipInfoTimer.Start();

+                            }

+                            isPartSelected = true;

+

+                            this.DrawTooltip(part);

+                            break;

+                        }

+                    }

+

+                    // If no part is being hovered over we must reset the extended information timer.

+                    if (!isPartSelected && this.selectedPart != null)

+                    {

+                        this.selectedPart = null;

+                        this.tooltipInfoTimer.Reset();

+                    }

+                }

+            }

+            catch

+            {

+                /* A null reference exception is thrown when checking if EditorLogic.fetch != null??? */

+            }

+        }

+

+        private void Window(int windowId)

+        {

+            GUILayout.BeginHorizontal();

+

+            // Titles

+            GUILayout.BeginVertical(GUILayout.Width(75.0f));

+            GUILayout.Label("Parts:", this.titleStyle);

+            GUILayout.Label("Delta-V:", this.titleStyle);

+            GUILayout.Label("TWR:", this.titleStyle);

+            GUILayout.EndVertical();

+

+            // Details

+            GUILayout.BeginVertical(GUILayout.Width(100.0f));

+            GUILayout.Label(SimulationManager.Instance.LastStage.partCount.ToString(), this.infoStyle);

+            GUILayout.Label(SimulationManager.Instance.LastStage.totalDeltaV.ToString("#,0.") + " m/s", this.infoStyle);

+            GUILayout.Label(SimulationManager.Instance.LastStage.TWR, this.infoStyle);

+            GUILayout.EndVertical();

+

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws the tooltip details of the selected/highlighted part.

+        /// </summary>

+        private void DrawTooltip(Part part)

+        {

+            // Tooltip title (name of part).

+            var content = new GUIContent(part.partInfo.title);

+            var size = this.tooltipTitleStyle.CalcSize(content);

+            var position = new Rect(Event.current.mousePosition.x + 16.0f, Event.current.mousePosition.y, size.x, size.y).ClampInsideScreen();

+

+            if (position.x < Event.current.mousePosition.x + 16.0f)

+            {

+                position.y += 16.0f;

+            }

+            GUI.Label(position, content, this.tooltipTitleStyle);

+

+            // After hovering for a period of time, show extended information.

+            if (this.tooltipInfoTimer.Elapsed.TotalSeconds >= this.tooltipInfoDelay)

+            {

+                // Stop the timer as it is no longer needed.

+                if (this.tooltipInfoTimer.IsRunning)

+                {

+                    this.tooltipInfoTimer.Stop();

+                }

+

+                // Show the dry mass of the part if applicable.

+                if (part.physicalSignificance == Part.PhysicalSignificance.FULL)

+                {

+                    this.DrawTooltipInfo(ref position, "Dry Mass: " + part.GetDryMass().ToMass());

+                }

+

+                // Show resources contained within the part.

+                if (part.ContainsResources())

+                {

+                    // Show the wet mass of the part if applicable.

+                    if (part.GetResourceMass() > 0)

+                    {

+                        this.DrawTooltipInfo(ref position, "Wet Mass: " + part.GetWetMass().ToMass());

+                    }

+

+                    // List all the resources contained within the part.

+                    foreach (PartResource resource in part.Resources)

+                    {

+                        if (resource.GetDensity() > 0)

+                        {

+                            this.DrawTooltipInfo(ref position, resource.info.name + ": " + resource.GetMass().ToMass() + " (" + resource.amount + ")");

+                        }

+                        else

+                        {

+                            this.DrawTooltipInfo(ref position, resource.info.name + ": " + resource.amount);

+                        }

+                    }

+                }

+

+                // Show details for engines.

+                if (part.IsEngine())

+                {

+                    this.DrawTooltipInfo(ref position, "Maximum Thrust: " + part.GetMaxThrust().ToForce());

+                    this.DrawTooltipInfo(ref position, "Specific Impulse: " + part.GetSpecificImpulse(1f) + " / " + part.GetSpecificImpulse(0f) + "s");

+

+                    // Thrust vectoring.

+                    if (part.HasModule("ModuleGimbal"))

+                    {

+                        this.DrawTooltipInfo(ref position, "Thrust Vectoring Enabled");

+                    }

+

+                    // Contains alternator.

+                    if (part.HasModule("ModuleAlternator"))

+                    {

+                        this.DrawTooltipInfo(ref position, "Contains Alternator");

+                    }

+                }

+

+                // Show details for RCS.

+                if (part.IsRcsModule())

+                {

+                    var moduleRcs = part.GetModuleRcs();

+                    this.DrawTooltipInfo(ref position, "Thrust Power: " + moduleRcs.thrusterPower.ToDouble().ToForce());

+                    this.DrawTooltipInfo(ref position, "Specific Impulse: " + moduleRcs.atmosphereCurve.Evaluate(1f) + " / " + moduleRcs.atmosphereCurve.Evaluate(0f) + "s");

+                }

+

+                // Show details for solar panels.

+                if (part.IsSolarPanel())

+                {

+                    this.DrawTooltipInfo(ref position, "Charge Rate: " + part.GetModuleDeployableSolarPanel().chargeRate.ToDouble().ToRate());

+                }

+

+                // Show details for generators.

+                if (part.IsGenerator())

+                {

+                    foreach (var resource in part.GetModuleGenerator().inputList)

+                    {

+                        this.DrawTooltipInfo(ref position, "Input: " + resource.name + " (" + resource.rate.ToDouble().ToRate() + ")");

+                    }

+

+                    foreach (var resource in part.GetModuleGenerator().outputList)

+                    {

+                        this.DrawTooltipInfo(ref position, "Output: " + resource.name + " (" + resource.rate.ToDouble().ToRate() + ")");

+                    }

+                }

+

+                // Show details for parachutes.

+                if (part.IsParachute())

+                {

+                    var module = part.GetModuleParachute();

+                    this.DrawTooltipInfo(ref position, "Semi Deployed Drag: " + module.semiDeployedDrag);

+                    this.DrawTooltipInfo(ref position, "Fully Deployed Drag: " + module.fullyDeployedDrag);

+                    this.DrawTooltipInfo(ref position, "Deployment Altitude: " + module.deployAltitude.ToDouble().ToDistance());

+                }

+

+                // Contains stability augmentation system.

+                if (part.HasModule("ModuleSAS"))

+                {

+                    this.DrawTooltipInfo(ref position, "Contains SAS");

+                }

+

+                // Contains reaction wheels.

+                if (part.HasModule("ModuleReactionWheel"))

+                {

+                    this.DrawTooltipInfo(ref position, "Contains Reaction Wheels");

+                }

+

+                // Show if the part has an animation that can only be used once.

+                if (part.HasOneShotAnimation())

+                {

+                    this.DrawTooltipInfo(ref position, "Single Activation Only");

+                }

+            }

+        }

+

+        /// <summary>

+        ///     Draws a line of extended information below the previous.

+        /// </summary>

+        private void DrawTooltipInfo(ref Rect position, string value)

+        {

+            var content = new GUIContent(value);

+            var size = this.tooltipInfoStyle.CalcSize(content);

+

+            position.y += 16.0f;

+            position.width = size.x;

+            position.height = size.y;

+            GUI.Label(position, content, this.tooltipInfoStyle);

+        }

+

+        #endregion

+

+        #region Save and Load

+

+        /// <summary>

+        ///     Saves the settings when this object is destroyed.

+        /// </summary>

+        private void OnDestroy()

+        {

+            try

+            {

+                var list = new SettingList();

+                list.AddSetting("visible", this.visible);

+                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/BuildOverlay", list);

+

+                print("[KerbalEngineer/BuildOverlay]: Successfully saved settings.");

+            }

+            catch

+            {

+                print("[KerbalEngineer/BuildOverlay]: Failed to save settings.");

+            }

+        }

+

+        /// <summary>

+        ///     Loads the settings when this object is created.

+        /// </summary>

+        private void Load()

+        {

+            try

+            {

+                var list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/BuildOverlay");

+                this.visible = (bool) list.GetSetting("visible", this.visible);

+

+                print("[KerbalEngineer/BuildOverlay]: Successfully loaded settings.");

+            }

+            catch

+            {

+                print("[KerbalEngineer/BuildOverlay]: Failed to load settigns.");

+            }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/CelestialBodies.cs
+++ b/KerbalEngineer/CelestialBodies.cs
@@ -1,114 +1,123 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.Collections.Generic;
-
-namespace KerbalEngineer
-{
-    public class CelestialBodies
-    {
-        #region Instance
-
-        private static CelestialBodies _instance;
-        /// <summary>
-        /// Gets or creates a global instance to be used.
-        /// </summary>
-        public static CelestialBodies Instance
-        {
-            get
-            {
-                if (_instance == null)
-                    _instance = new CelestialBodies();
-
-                return _instance;
-            }
-        }
-
-        #endregion
-
-        #region Properties
-
-        /// <summary>
-        /// Gets a list of BodyInfo objects.
-        /// </summary>
-        public Dictionary<string, BodyInfo> BodyList { get; private set; }
-
-        private string _selectedBodyName = null;
-        /// <summary>
-        /// Gets and sets the selected body name.
-        /// </summary>
-        public string SelectedBodyName
-        {
-            get { return _selectedBodyName; }
-            set
-            {
-                _selectedBodyName = value;
-                if (BodyList.ContainsKey(_selectedBodyName))
-                    SelectedBodyInfo = BodyList[_selectedBodyName];
-            }
-        }
-
-        /// <summary>
-        /// Gets the selected BodyInfo object.
-        /// </summary>
-        public BodyInfo SelectedBodyInfo { get; private set; }
-
-        #endregion
-
-        #region Initialisation
-
-        private CelestialBodies()
-        {
-            BodyList = new Dictionary<string, BodyInfo>();
-            AddBody(new BodyInfo("Moho", 2.7d, 0d, null, null));
-            AddBody(new BodyInfo("Eve", 16.7d, 506.625d, null, new string[] { "Gilly" }));
-            AddBody(new BodyInfo("Gilly", 0.049d, 0d, "Eve", null));
-            AddBody(new BodyInfo("Kerbin", 9.81d, 101.325d, null, new string[] { "Mun", "Minmus" }));
-            AddBody(new BodyInfo("Mun", 1.63d, 0d, "Kerbin", null));
-            AddBody(new BodyInfo("Minmus", 0.491d, 0d, "Kerbin", null));
-            AddBody(new BodyInfo("Duna", 2.94d, 20.2650d, null, new string[] { "Ike" }));
-            AddBody(new BodyInfo("Ike", 1.1d, 0d, "Duna", null));
-            AddBody(new BodyInfo("Dres", 1.13d, 0d, null, null));
-            AddBody(new BodyInfo("Jool", 7.85d, 1519.88d, null, new string[] { "Laythe", "Vall", "Tylo", "Bop", "Pol" }));
-            AddBody(new BodyInfo("Laythe", 7.85d, 81.06d, "Jool", null));
-            AddBody(new BodyInfo("Vall", 2.31d, 0d, "Jool", null));
-            AddBody(new BodyInfo("Tylo", 7.85d, 0d, "Jool", null));
-            AddBody(new BodyInfo("Bop", 0.589d, 0d, "Jool", null));
-            AddBody(new BodyInfo("Pol", 0.373d, 0d, "Jool", null));
-            AddBody(new BodyInfo("Eeloo", 1.69d, 0d, null, null));
-
-            SelectedBodyName = "Kerbin";
-        }
-
-        private void AddBody(BodyInfo bodyInfo)
-        {
-            BodyList.Add(bodyInfo.Name, bodyInfo);
-        }
-
-        #endregion
-
-        #region Embedded Classes
-
-        public class BodyInfo
-        {
-            public string Name { get; protected set; }
-            public double Gravity { get; protected set; }
-            public double Atmosphere { get; protected set; }
-            public string Parent { get; protected set; }
-            public string[] Children { get; protected set; }
-
-            public BodyInfo(string name, double gravity, double atmosphere, string parent, string[] children)
-            {
-                Name = name;
-                Gravity = gravity;
-                Atmosphere = atmosphere;
-                Parent = parent;
-                Children = children;
-            }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.Collections.Generic;

+

+#endregion

+

+namespace KerbalEngineer

+{

+    public class CelestialBodies

+    {

+        #region Instance

+

+        private static CelestialBodies _instance;

+

+        /// <summary>

+        ///     Gets or creates a global instance to be used.

+        /// </summary>

+        public static CelestialBodies Instance

+        {

+            get { return _instance ?? (_instance = new CelestialBodies()); }

+        }

+

+        #endregion

+

+        #region Fields

+

+        private string selectedBodyName;

+

+        #endregion

+

+        #region Properties

+

+        /// <summary>

+        ///     Gets a list of BodyInfo objects.

+        /// </summary>

+        public Dictionary<string, BodyInfo> BodyList { get; private set; }

+

+        /// <summary>

+        ///     Gets and sets the selected body name.

+        /// </summary>

+        public string SelectedBodyName

+        {

+            get { return this.selectedBodyName; }

+            set

+            {

+                this.selectedBodyName = value;

+                if (this.BodyList.ContainsKey(this.selectedBodyName))

+                {

+                    this.SelectedBodyInfo = this.BodyList[this.selectedBodyName];

+                }

+            }

+        }

+

+        /// <summary>

+        ///     Gets the selected BodyInfo object.

+        /// </summary>

+        public BodyInfo SelectedBodyInfo { get; private set; }

+

+        #endregion

+

+        #region Initialisation

+

+        private CelestialBodies()

+        {

+            this.BodyList = new Dictionary<string, BodyInfo>();

+            this.AddBody(new BodyInfo("Moho", 2.7d, 0, null, null));

+            this.AddBody(new BodyInfo("Eve", 16.7d, 506.625d, null, new[] {"Gilly"}));

+            this.AddBody(new BodyInfo("Gilly", 0.049d, 0, "Eve", null));

+            this.AddBody(new BodyInfo("Kerbin", 9.81d, 101.325d, null, new[] {"Mun", "Minmus"}));

+            this.AddBody(new BodyInfo("Mun", 1.63d, 0, "Kerbin", null));

+            this.AddBody(new BodyInfo("Minmus", 0.491d, 0, "Kerbin", null));

+            this.AddBody(new BodyInfo("Duna", 2.94d, 20.2650d, null, new[] {"Ike"}));

+            this.AddBody(new BodyInfo("Ike", 1.1d, 0, "Duna", null));

+            this.AddBody(new BodyInfo("Dres", 1.13d, 0, null, null));

+            this.AddBody(new BodyInfo("Jool", 7.85d, 1519.88d, null, new[] {"Laythe", "Vall", "Tylo", "Bop", "Pol"}));

+            this.AddBody(new BodyInfo("Laythe", 7.85d, 81.06d, "Jool", null));

+            this.AddBody(new BodyInfo("Vall", 2.31d, 0, "Jool", null));

+            this.AddBody(new BodyInfo("Tylo", 7.85d, 0, "Jool", null));

+            this.AddBody(new BodyInfo("Bop", 0.589d, 0, "Jool", null));

+            this.AddBody(new BodyInfo("Pol", 0.373d, 0, "Jool", null));

+            this.AddBody(new BodyInfo("Eeloo", 1.69d, 0, null, null));

+

+            this.SelectedBodyName = "Kerbin";

+        }

+

+        #endregion

+

+        #region Methods

+

+        private void AddBody(BodyInfo bodyInfo)

+        {

+            this.BodyList.Add(bodyInfo.Name, bodyInfo);

+        }

+

+        #endregion

+

+        #region Embedded Classes

+

+        public class BodyInfo

+        {

+            public BodyInfo(string name, double gravity, double atmosphere, string parent, string[] children)

+            {

+                this.Name = name;

+                this.Gravity = gravity;

+                this.Atmosphere = atmosphere;

+                this.Parent = parent;

+                this.Children = children;

+            }

+

+            public string Name { get; protected set; }

+            public double Gravity { get; protected set; }

+            public double Atmosphere { get; protected set; }

+            public string Parent { get; protected set; }

+            public string[] Children { get; protected set; }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/EngineerGlobals.cs
+++ b/KerbalEngineer/EngineerGlobals.cs
@@ -1,80 +1,73 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.Diagnostics;
-using System.IO;
-using System.Reflection;
-using UnityEngine;
-
-namespace KerbalEngineer
-{
-    public class EngineerGlobals
-    {
-        #region Properties
-
-        /// <summary>
-        /// Current version of the Kerbal Engineer assembly.
-        /// </summary>
-        public const string AssemblyVersion = "1.0.0.0";
-
-        private static string _assemblyFile;
-        /// <summary>
-        /// Gets the Kerbal Engineer assembly's path including the file name.
-        /// </summary>
-        public static string AssemblyFile
-        {
-            get
-            {
-                if (_assemblyFile == null)
-                    _assemblyFile = Assembly.GetExecutingAssembly().Location;
-
-                return _assemblyFile;
-            }
-        }
-
-        private static string _assemblyName;
-        /// <summary>
-        /// Gets the Kerbal Engineer assembly's file name.
-        /// </summary>
-        public static string AssemblyName
-        {
-            get
-            {
-                if (_assemblyName == null)
-                    _assemblyName = new FileInfo(AssemblyFile).Name;
-
-                return _assemblyName;
-            }
-        }
-
-        private static string _assemblyPath;
-        /// <summary>
-        /// Gets the Kerbal Engineer assembly's path excluding the file name.
-        /// </summary>
-        public static string AssemblyPath
-        {
-            get
-            {
-                if (_assemblyPath == null)
-                    _assemblyPath = AssemblyFile.Replace(new FileInfo(AssemblyFile).Name, "");
-
-                return _assemblyPath;
-            }
-        }
-
-        #endregion
-
-        #region Methods
-
-        private static int _windowID = int.MaxValue;
-        public static int GetNextWindowID()
-        {
-            _windowID--;
-            return _windowID;
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.IO;

+using System.Reflection;

+

+#endregion

+

+namespace KerbalEngineer

+{

+    public class EngineerGlobals

+    {

+        #region Constants

+

+        /// <summary>

+        ///     Current version of the Kerbal Engineer assembly.

+        /// </summary>

+        public const string AssemblyVersion = "1.0.0.0";

+

+        #endregion

+

+        #region Fields

+

+        private static int _windowId = int.MaxValue;

+

+        #endregion

+

+        #region Properties

+

+        private static string _assemblyFile;

+        private static string _assemblyName;

+        private static string _assemblyPath;

+

+        /// <summary>

+        ///     Gets the Kerbal Engineer assembly's path including the file name.

+        /// </summary>

+        public static string AssemblyFile

+        {

+            get { return _assemblyFile ?? (_assemblyFile = Assembly.GetExecutingAssembly().Location); }

+        }

+

+        /// <summary>

+        ///     Gets the Kerbal Engineer assembly's file name.

+        /// </summary>

+        public static string AssemblyName

+        {

+            get { return _assemblyName ?? (_assemblyName = new FileInfo(AssemblyFile).Name); }

+        }

+

+        /// <summary>

+        ///     Gets the Kerbal Engineer assembly's path excluding the file name.

+        /// </summary>

+        public static string AssemblyPath

+        {

+            get { return _assemblyPath ?? (_assemblyPath = AssemblyFile.Replace(new FileInfo(AssemblyFile).Name, "")); }

+        }

+

+        #endregion

+

+        #region Methods

+

+        public static int GetNextWindowId()

+        {

+            _windowId--;

+            return _windowId;

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/Extensions/DoubleExtensions.cs
+++ b/KerbalEngineer/Extensions/DoubleExtensions.cs
@@ -1,181 +1,73 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-namespace KerbalEngineer.Extensions
-{
-    public static class DoubleExtensions
-    {
-        /// <summary>
-        /// Convert to a string formatted as a mass.
-        /// </summary>
-        public static string ToMass(this double value, bool showNotation = true)
-        {
-            value *= 1000;
-
-            if (showNotation)
-                return value.ToString("#,0.") + "kg";
-            else
-                return value.ToString("#,0.");
-        }
-
-        /// <summary>
-        /// Convert to string formatted as a force.
-        /// </summary>
-        public static string ToForce(this double value, bool showNotation = true)
-        {
-            if (HighLogic.LoadedSceneIsFlight)
-            {
-                if (showNotation)
-                    return value.ToString("#,0.00") + "kN";
-                else
-                    return value.ToString("#,0.00");
-            }
-            else
-            {
-                if (showNotation)
-                    return value.ToString("#,0.##") + "kN";
-                else
-                    return value.ToString("#,0.##");
-            }
-        }
-
-        /// <summary>
-        /// Convert to string formatted as a speed.
-        /// </summary>
-        public static string ToSpeed(this double value, bool showNotation = true)
-        {
-            if (showNotation)
-                return value.ToString("#,0.00") + "m/s";
-            else
-                return value.ToString("#,0.00");
-        }
-
-        /// <summary>
-        /// Convert to string formatted as a distance.
-        /// </summary>
-        public static string ToDistance(this double value)
-        {
-            bool negative = value < 0d;
-
-            if (negative) value = -value;
-
-            if (value < 1000000d)
-            {
-                if (value < 1d)
-                {
-                    value *= 1000d;
-
-                    if (negative) value = -value;
-                    return value.ToString("#,0.") + "mm";
-                }
-                else
-                {
-                    if (negative) value = -value;
-                    return value.ToString("#,0.") + "m";
-                }
-            }
-            else
-            {
-                value /= 1000d;
-                if (value >= 1000000d)
-                {
-                    value /= 1000d;
-                    if (negative) value = -value;
-                    return value.ToString("#,0." + "Mm");
-                }
-                else
-                {
-                    if (negative) value = -value;
-                    return value.ToString("#,0." + "km");
-                }
-            }
-        }
-
-        /// <summary>
-        /// Convert to string formatted as a rate.
-        /// </summary>
-        public static string ToRate(this double value)
-        {
-            if (value > 0)
-                return value.ToString("0.0") + "/sec";
-            else
-                return (60d * value).ToString("0.0") + "/min";
-        }
-
-        /// <summary>
-        /// Convert to string formatted as an angle.
-        /// </summary>
-        public static string ToAngle(this double value)
-        {
-            return value.ToString("0.000") + "°";
-        }
-
-        /// <summary>
-        /// Convert to string formatted as a time.
-        /// </summary>
-        public static string ToTime(this double value)
-        {
-            double s = value;
-            int m = 0;
-            int h = 0;
-            double d = 0d;
-            double y = 0d;
-
-            if (s >= 31536000)
-            {
-                while (s >= 31536000)
-                {
-                    y++;
-                    s -= 31536000;
-                }
-
-                y += (s / 31536000);
-                return y.ToString("0.000") + "y";
-            }
-
-            if (s >= 86400)
-            {
-                while (s >= 86400)
-                {
-                    d++;
-                    s -= 86400;
-                }
-
-                d += (s / 86400);
-                return d.ToString("0.000") + "d";
-            }
-
-            while (s >= 60)
-            {
-                m++;
-                s -= 60;
-            }
-
-            while (m >= 60)
-            {
-                h++;
-                m -= 60;
-            }
-
-            while (h >= 24)
-            {
-                d++;
-                h -= 24;
-            }
-
-            if (h > 0)
-            {
-                return h + "h " + m.ToString("00") + "m " + s.ToString("00.0") + "s";
-            }
-
-            if (m > 0)
-            {
-                return m + "m " + s.ToString("00.0") + "s";
-            }
-
-            return s.ToString("0.0") + "s";
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+namespace KerbalEngineer.Extensions

+{

+    public static class DoubleExtensions

+    {

+        /// <summary>

+        ///     Convert to a single precision floating point number.

+        /// </summary>

+        public static float ToFloat(this double value)

+        {

+            return (float)value;

+        }

+

+        /// <summary>

+        ///     Convert to a string formatted as a mass.

+        /// </summary>

+        public static string ToMass(this double value, bool showNotation = true)

+        {

+            return ToFloat(value).ToMass(showNotation);

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a force.

+        /// </summary>

+        public static string ToForce(this double value, bool showNotation = true)

+        {

+            return ToFloat(value).ToForce(showNotation);

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a speed.

+        /// </summary>

+        public static string ToSpeed(this double value, bool showNotation = true)

+        {

+            return ToFloat(value).ToSpeed(showNotation);

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a distance.

+        /// </summary>

+        public static string ToDistance(this double value)

+        {

+            return ToFloat(value).ToDistance();

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a rate.

+        /// </summary>

+        public static string ToRate(this double value)

+        {

+            return ToFloat(value).ToRate();

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as an angle.

+        /// </summary>

+        public static string ToAngle(this double value)

+        {

+            return ToFloat(value).ToAngle();

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a time.

+        /// </summary>

+        public static string ToTime(this double value)

+        {

+            return ToFloat(value).ToTime();

+        }

+    }

 }
-

--- a/KerbalEngineer/Extensions/FloatExtensions.cs
+++ b/KerbalEngineer/Extensions/FloatExtensions.cs
@@ -1,18 +1,172 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-namespace KerbalEngineer.Extensions
-{
-    public static class FloatExtensions
-    {
-        /// <summary>
-        /// Convert to a single precision floating point number.
-        /// </summary>
-        public static double ToDouble(this float value)
-        {
-            return (double)value;
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+namespace KerbalEngineer.Extensions

+{

+    public static class FloatExtensions

+    {

+        /// <summary>

+        ///     Convert to a double precision floating point number.

+        /// </summary>

+        public static double ToDouble(this float value)

+        {

+            return value;

+        }

+

+        /// <summary>

+        ///     Convert to a string formatted as a mass.

+        /// </summary>

+        public static string ToMass(this float value, bool showNotation = true)

+        {

+            value *= 1000;

+

+            return showNotation ? value.ToString("#,0.") + "kg" : value.ToString("#,0.");

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a force.

+        /// </summary>

+        public static string ToForce(this float value, bool showNotation = true)

+        {

+            return showNotation ? value.ToString("#,0.00") + "kN" : value.ToString("#,0.00");

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a speed.

+        /// </summary>

+        public static string ToSpeed(this float value, bool showNotation = true)

+        {

+            return showNotation ? value.ToString("#,0.00") + "m/s" : value.ToString("#,0.00");

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a distance.

+        /// </summary>

+        public static string ToDistance(this float value)

+        {

+            var negative = value < 0;

+

+            if (negative)

+            {

+                value = -value;

+            }

+

+            if (value < 1000000.0f)

+            {

+                if (value < 1.0f)

+                {

+                    value *= 1000.0f;

+

+                    if (negative)

+                    {

+                        value = -value;

+                    }

+                    return value.ToString("#,0.") + "mm";

+                }

+

+                if (negative)

+                {

+                    value = -value;

+                }

+                return value.ToString("#,0.") + "m";

+            }

+

+            value /= 1000.0f;

+            if (value >= 1000000.0f)

+            {

+                value /= 1000.0f;

+

+                if (negative)

+                {

+                    value = -value;

+                }

+                return value.ToString("#,0." + "Mm");

+            }

+

+            if (negative)

+            {

+                value = -value;

+            }

+            return value.ToString("#,0." + "km");

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a rate.

+        /// </summary>

+        public static string ToRate(this float value)

+        {

+            return value > 0 ? value.ToString("0.0") + "/sec" : (60.0f * value).ToString("0.0") + "/min";

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as an angle.

+        /// </summary>

+        public static string ToAngle(this float value)

+        {

+            return value.ToString("0.000") + "°";

+        }

+

+        /// <summary>

+        ///     Convert to string formatted as a time.

+        /// </summary>

+        public static string ToTime(this float value)

+        {

+            var s = value;

+            var m = 0;

+            var h = 0;

+            var d = 0;

+            var y = 0;

+

+            // Years

+            while (s >= 31536000)

+            {

+                y++;

+                s -= 31536000;

+            }

+

+            // Days

+            while (s >= 86400)

+            {

+                d++;

+                s -= 86400;

+            }

+

+            // Hours

+            while (s >= 3600)

+            {

+                h++;

+                s -= 3600;

+            }

+

+            // Minutes

+            while (s >= 60)

+            {

+                m++;

+                s -= 60;

+            }

+

+            if (y > 0)

+            {

+                return y + "y " + d + "d " + h + "h " + m + "m " + s.ToString("00.0") + "s";

+            }

+

+            if (d > 0)

+            {

+                return d + "d " + h + "h " + m + "m " + s.ToString("00.0") + "s";

+            }

+

+            if (h > 0)

+            {

+                return h + "h " + m + "m " + s.ToString("00.0") + "s";

+            }

+

+            if (m > 0)

+            {

+                return m + "m " + s.ToString("00.0") + "s";

+            }

+

+            return s.ToString("0.0") + "s";

+        }

+    }

 }
-

--- a/KerbalEngineer/Extensions/PartExtensions.cs
+++ b/KerbalEngineer/Extensions/PartExtensions.cs
@@ -1,347 +1,338 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using UnityEngine;
-
-namespace KerbalEngineer.Extensions
-{
-    public static class PartExtensions
-    {
-        /// <summary>
-        /// Gets whether the part contains a PartModule.
-        /// </summary>
-        public static bool HasModule<T>(this Part part)
-        {
-            return part.Modules.OfType<T>().Count() > 0;
-        }
-
-        /// <summary>
-        /// Gets whether the part contains a PartModule.
-        /// </summary>
-        public static bool HasModule(this Part part, string className)
-        {
-            return part.Modules.Contains(className);
-        }
-
-        /// <summary>
-        /// Gets whether the part contains a PartModule.
-        /// </summary>
-        public static bool HasModule(this Part part, int moduleID)
-        {
-            return part.Modules.Contains(moduleID);
-        }
-
-        /// <summary>
-        /// Gets the first typed PartModule in the part's module list.
-        /// </summary>
-        public static T GetModule<T>(this Part part) where T : PartModule
-        {
-            foreach (PartModule module in part.Modules)
-                if (module is T)
-                    return module as T;
-
-            return null;
-        }
-
-        /// <summary>
-        /// Gets a typed PartModule.
-        /// </summary>
-        public static T GetModule<T>(this Part part, string className) where T : PartModule
-        {
-            return (T)Convert.ChangeType(part.Modules[className], typeof(T));
-        }
-
-        /// <summary>
-        /// Gets a typed PartModule.
-        /// </summary>
-        public static T GetModule<T>(this Part part, int classID) where T : PartModule
-        {
-            return (T)Convert.ChangeType(part.Modules[classID], typeof(T));
-        }
-
-        /// <summary>
-        /// Gets a ModuleEngines typed PartModule.
-        /// </summary>
-        public static ModuleEngines GetModuleEngines(this Part part)
-        {
-            return part.GetModule<ModuleEngines>();
-        }
-
-        /// <summary>
-        /// Gets the current selected ModuleEnginesFX.
-        /// </summary>
-        public static ModuleEnginesFX GetModuleEnginesFX(this Part part)
-        {
-            string mode = part.GetModule<MultiModeEngine>().mode;
-
-            foreach (ModuleEnginesFX engine in part.Modules.OfType<ModuleEnginesFX>())
-            {
-                if (engine.engineID == mode)
-                    return engine;
-            }
-
-            return null;
-        }
-
-        public static ModuleRCS GetModuleRCS(this Part part)
-        {
-            return part.GetModule<ModuleRCS>();
-        }
-
-        /// <summary>
-        /// Gets a ModuleGimbal typed PartModule.
-        /// </summary>
-        public static ModuleGimbal GetModuleGimbal(this Part part)
-        {
-            return part.GetModule<ModuleGimbal>();
-        }
-
-        /// <summary>
-        /// Gets a ModuleDeployableSolarPanel typed PartModule.
-        /// </summary>
-        public static ModuleDeployableSolarPanel GetModuleDeployableSolarPanel(this Part part)
-        {
-            return part.GetModule<ModuleDeployableSolarPanel>();
-        }
-
-        /// <summary>
-        /// Gets a ModuleAlternator typed PartModule.
-        /// </summary>
-        public static ModuleAlternator GetModuleAlternator(this Part part)
-        {
-            return part.GetModule<ModuleAlternator>();
-        }
-
-        /// <summary>
-        /// Gets a ModuleGenerator typed PartModule.
-        /// </summary>
-        public static ModuleGenerator GetModuleGenerator(this Part part)
-        {
-            return part.GetModule<ModuleGenerator>();
-        }
-
-        /// <summary>
-        /// Gets a ModuleParachute typed PartModule.
-        /// </summary>
-        public static ModuleParachute GetModuleParachute(this Part part)
-        {
-            return part.GetModule<ModuleParachute>();
-        }
-
-        /// <summary>
-        /// Gets the total mass of the part including resources.
-        /// </summary>
-        public static double GetWetMass(this Part part)
-        {
-            return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass + part.GetResourceMass() : part.GetResourceMass();
-        }
-
-        /// <summary>
-        /// Gets the dry mass of the part.
-        /// </summary>
-        public static double GetDryMass(this Part part)
-        {
-            return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass : 0d;
-        }
-
-        /// <summary>
-        /// Gets the maximum thrust of the part if it's an engine.
-        /// </summary>
-        public static double GetMaxThrust(this Part part)
-        {
-            if (part.HasModule<ModuleEngines>())
-            {
-                return part.GetModuleEngines().maxThrust;
-            }
-            else if (part.HasModule<MultiModeEngine>())
-            {
-                return part.GetModuleEnginesFX().maxThrust;
-            }
-
-            return 0d;
-        }
-
-        /// <summary>
-        /// Gets the current specific impulse for the engine.
-        /// </summary>
-        public static double GetSpecificImpulse(this Part part, float atmosphere)
-        {
-            if (part.HasModule<ModuleEngines>())
-            {
-                return part.GetModuleEngines().atmosphereCurve.Evaluate(atmosphere);
-            }
-            else if (part.HasModule<MultiModeEngine>())
-            {
-                return part.GetModuleEnginesFX().atmosphereCurve.Evaluate(atmosphere);
-            }
-
-            return 0d;
-        }
-
-        /// <summary>
-        /// Gets whether the part has fuel.
-        /// </summary>
-        public static bool EngineHasFuel(this Part part)
-        {
-            if (part.HasModule<ModuleEngines>())
-            {
-                return part.GetModuleEngines().getFlameoutState;
-            }
-            else if (part.HasModule<MultiModeEngine>())
-            {
-                return part.GetModuleEnginesFX().getFlameoutState;
-            }
-
-            return false;
-        }
-
-        /// <summary>
-        /// Gets whether the part contains resources.
-        /// </summary>
-        public static bool ContainsResources(this Part part)
-        {
-            return part.Resources.list.Count(p => p.amount > 0d) > 0;
-        }
-
-        public static bool ContainsResource(this Part part, int resourceID)
-        {
-            return part.Resources.Contains(resourceID);
-        }
-
-        /// <summary>
-        /// Gets whether the part is a decoupler.
-        /// </summary>
-        public static bool IsDecoupler(this Part part)
-        {
-            return part.HasModule<ModuleDecouple>() || part.HasModule<ModuleAnchoredDecoupler>();
-        }
-
-        /// <summary>
-        /// Gets whether the part is decoupled in a specified stage.
-        /// </summary>
-        public static bool IsDecoupledInStage(this Part part, int stage)
-        {
-            if ((part.IsDecoupler() || part.IsLaunchClamp()) && part.inverseStage == stage) return true;
-            if (part.parent == null) return false;
-            return part.parent.IsDecoupledInStage(stage);
-        }
-
-        /// <summary>
-        /// Gets whether the part is a launch clamp.
-        /// </summary>
-        public static bool IsLaunchClamp(this Part part)
-        {
-            return part.HasModule<LaunchClamp>();
-        }
-
-        /// <summary>
-        /// Gets whether the part is an active engine.
-        /// </summary>
-        public static bool IsEngine(this Part part)
-        {
-            return part.HasModule<ModuleEngines>() || part.HasModule<MultiModeEngine>();
-        }
-
-        public static bool IsRCSModule(this Part part)
-        {
-            return part.HasModule<ModuleRCS>();
-        }
-
-        /// <summary>
-        /// Gets whether the part is a deployable solar panel.
-        /// </summary>
-        public static bool IsSolarPanel(this Part part)
-        {
-            return part.HasModule<ModuleDeployableSolarPanel>();
-        }
-
-        /// <summary>
-        /// Gets whether the part is a generator.
-        /// </summary>
-        public static bool IsGenerator(this Part part)
-        {
-            return part.HasModule<ModuleGenerator>();
-        }
-
-        /// <summary>
-        /// Gets whether the part is a command module.
-        /// </summary>
-        public static bool IsCommandModule(this Part part)
-        {
-            return part.HasModule<ModuleCommand>();
-        }
-
-        /// <summary>
-        /// Gets whether the part is a parachute.
-        /// </summary>
-        public static bool IsParachute(this Part part)
-        {
-            return part.HasModule<ModuleParachute>();
-        }
-
-        /// <summary>
-        /// Gets whether the part is a solid rocket motor.
-        /// </summary>
-        public static bool IsSolidRocket(this Part part)
-        {
-            return part.HasModule<ModuleEngines>() && part.GetModuleEngines().throttleLocked;
-        }
-
-        /// <summary>
-        /// Gets whether the part is a sepratron.
-        /// </summary>
-        public static bool IsSepratron(this Part part)
-        {
-            return (part.IsSolidRocket() && part.ActivatesEvenIfDisconnected && part.IsDecoupledInStage(part.inverseStage));
-        }
-
-        /// <summary>
-        /// Gets whether the part is a fuel line.
-        /// </summary>
-        public static bool IsFuelLine(this Part part)
-        {
-            return (part is FuelLine);
-        }
-
-        /// <summary>
-        /// Gets whether the part is considered a primary part on the vessel.
-        /// </summary>
-        public static bool IsPrimary(this Part part, List<Part> partsList, PartModule module)
-        {
-            foreach (Part vesselPart in partsList)
-            {
-                if (vesselPart.HasModule(module.ClassID))
-                {
-                    if (vesselPart == part)
-                    {
-                        return true;
-                    }
-                    else
-                    {
-                        break;
-                    }
-                }
-            }
-
-            return false;
-        }
-
-        /// <summary>
-        /// Gets whether the part has a one shot animation.
-        /// </summary>
-        public static bool HasOneShotAnimation(this Part part)
-        {
-            if (part.HasModule<ModuleAnimateGeneric>())
-            {
-                return part.GetModule<ModuleAnimateGeneric>().isOneShot;
-            }
-
-            return false;
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System;

+using System.Collections.Generic;

+using System.Linq;

+

+#endregion

+

+namespace KerbalEngineer.Extensions

+{

+    public static class PartExtensions

+    {

+        /// <summary>

+        ///     Gets whether the part contains a PartModule.

+        /// </summary>

+        public static bool HasModule<T>(this Part part)

+        {

+            return part.Modules.OfType<T>().Any();

+        }

+

+        /// <summary>

+        ///     Gets whether the part contains a PartModule.

+        /// </summary>

+        public static bool HasModule(this Part part, string className)

+        {

+            return part.Modules.Contains(className);

+        }

+

+        /// <summary>

+        ///     Gets whether the part contains a PartModule.

+        /// </summary>

+        public static bool HasModule(this Part part, int moduleId)

+        {

+            return part.Modules.Contains(moduleId);

+        }

+

+        /// <summary>

+        ///     Gets the first typed PartModule in the part's module list.

+        /// </summary>

+        public static T GetModule<T>(this Part part) where T : PartModule

+        {

+            return part.Modules.OfType<T>().FirstOrDefault();

+        }

+

+        /// <summary>

+        ///     Gets a typed PartModule.

+        /// </summary>

+        public static T GetModule<T>(this Part part, string className) where T : PartModule

+        {

+            return (T)Convert.ChangeType(part.Modules[className], typeof (T));

+        }

+

+        /// <summary>

+        ///     Gets a typed PartModule.

+        /// </summary>

+        public static T GetModule<T>(this Part part, int classId) where T : PartModule

+        {

+            return (T)Convert.ChangeType(part.Modules[classId], typeof (T));

+        }

+

+        /// <summary>

+        ///     Gets a ModuleEngines typed PartModule.

+        /// </summary>

+        public static ModuleEngines GetModuleEngines(this Part part)

+        {

+            return part.GetModule<ModuleEngines>();

+        }

+

+        /// <summary>

+        ///     Gets the current selected ModuleEnginesFX.

+        /// </summary>

+        public static ModuleEnginesFX GetModuleEnginesFx(this Part part)

+        {

+            var mode = part.GetModule<MultiModeEngine>().mode;

+            return part.Modules.OfType<ModuleEnginesFX>().FirstOrDefault(engine => engine.engineID == mode);

+        }

+

+        public static ModuleRCS GetModuleRcs(this Part part)

+        {

+            return part.GetModule<ModuleRCS>();

+        }

+

+        /// <summary>

+        ///     Gets a ModuleGimbal typed PartModule.

+        /// </summary>

+        public static ModuleGimbal GetModuleGimbal(this Part part)

+        {

+            return part.GetModule<ModuleGimbal>();

+        }

+

+        /// <summary>

+        ///     Gets a ModuleDeployableSolarPanel typed PartModule.

+        /// </summary>

+        public static ModuleDeployableSolarPanel GetModuleDeployableSolarPanel(this Part part)

+        {

+            return part.GetModule<ModuleDeployableSolarPanel>();

+        }

+

+        /// <summary>

+        ///     Gets a ModuleAlternator typed PartModule.

+        /// </summary>

+        public static ModuleAlternator GetModuleAlternator(this Part part)

+        {

+            return part.GetModule<ModuleAlternator>();

+        }

+

+        /// <summary>

+        ///     Gets a ModuleGenerator typed PartModule.

+        /// </summary>

+        public static ModuleGenerator GetModuleGenerator(this Part part)

+        {

+            return part.GetModule<ModuleGenerator>();

+        }

+

+        /// <summary>

+        ///     Gets a ModuleParachute typed PartModule.

+        /// </summary>

+        public static ModuleParachute GetModuleParachute(this Part part)

+        {

+            return part.GetModule<ModuleParachute>();

+        }

+

+        /// <summary>

+        ///     Gets the total mass of the part including resources.

+        /// </summary>

+        public static double GetWetMass(this Part part)

+        {

+            return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass + part.GetResourceMass() : part.GetResourceMass();

+        }

+

+        /// <summary>

+        ///     Gets the dry mass of the part.

+        /// </summary>

+        public static double GetDryMass(this Part part)

+        {

+            return (part.physicalSignificance == Part.PhysicalSignificance.FULL) ? part.mass : 0d;

+        }

+

+        /// <summary>

+        ///     Gets the maximum thrust of the part if it's an engine.

+        /// </summary>

+        public static double GetMaxThrust(this Part part)

+        {

+            if (part.HasModule<ModuleEngines>())

+            {

+                return part.GetModuleEngines().maxThrust;

+            }

+            if (part.HasModule<MultiModeEngine>())

+            {

+                return part.GetModuleEnginesFx().maxThrust;

+            }

+

+            return 0d;

+        }

+

+        /// <summary>

+        ///     Gets the current specific impulse for the engine.

+        /// </summary>

+        public static double GetSpecificImpulse(this Part part, float atmosphere)

+        {

+            if (part.HasModule<ModuleEngines>())

+            {

+                return part.GetModuleEngines().atmosphereCurve.Evaluate(atmosphere);

+            }

+            if (part.HasModule<MultiModeEngine>())

+            {

+                return part.GetModuleEnginesFx().atmosphereCurve.Evaluate(atmosphere);

+            }

+

+            return 0d;

+        }

+

+        /// <summary>

+        ///     Gets whether the part has fuel.

+        /// </summary>

+        public static bool EngineHasFuel(this Part part)

+        {

+            if (part.HasModule<ModuleEngines>())

+            {

+                return part.GetModuleEngines().getFlameoutState;

+            }

+            if (part.HasModule<MultiModeEngine>())

+            {

+                return part.GetModuleEnginesFx().getFlameoutState;

+            }

+

+            return false;

+        }

+

+        /// <summary>

+        ///     Gets whether the part contains resources.

+        /// </summary>

+        public static bool ContainsResources(this Part part)

+        {

+            return part.Resources.list.Count(p => p.amount > 0d) > 0;

+        }

+

+        public static bool ContainsResource(this Part part, int resourceId)

+        {

+            return part.Resources.Contains(resourceId);

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a decoupler.

+        /// </summary>

+        public static bool IsDecoupler(this Part part)

+        {

+            return part.HasModule<ModuleDecouple>() || part.HasModule<ModuleAnchoredDecoupler>();

+        }

+

+        /// <summary>

+        ///     Gets whether the part is decoupled in a specified stage.

+        /// </summary>

+        public static bool IsDecoupledInStage(this Part part, int stage)

+        {

+            if ((part.IsDecoupler() || part.IsLaunchClamp()) && part.inverseStage == stage)

+            {

+                return true;

+            }

+            if (part.parent == null)

+            {

+                return false;

+            }

+            return part.parent.IsDecoupledInStage(stage);

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a launch clamp.

+        /// </summary>

+        public static bool IsLaunchClamp(this Part part)

+        {

+            return part.HasModule<LaunchClamp>();

+        }

+

+        /// <summary>

+        ///     Gets whether the part is an active engine.

+        /// </summary>

+        public static bool IsEngine(this Part part)

+        {

+            return part.HasModule<ModuleEngines>() || part.HasModule<MultiModeEngine>();

+        }

+

+        public static bool IsRcsModule(this Part part)

+        {

+            return part.HasModule<ModuleRCS>();

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a deployable solar panel.

+        /// </summary>

+        public static bool IsSolarPanel(this Part part)

+        {

+            return part.HasModule<ModuleDeployableSolarPanel>();

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a generator.

+        /// </summary>

+        public static bool IsGenerator(this Part part)

+        {

+            return part.HasModule<ModuleGenerator>();

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a command module.

+        /// </summary>

+        public static bool IsCommandModule(this Part part)

+        {

+            return part.HasModule<ModuleCommand>();

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a parachute.

+        /// </summary>

+        public static bool IsParachute(this Part part)

+        {

+            return part.HasModule<ModuleParachute>();

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a solid rocket motor.

+        /// </summary>

+        public static bool IsSolidRocket(this Part part)

+        {

+            return part.HasModule<ModuleEngines>() && part.GetModuleEngines().throttleLocked;

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a sepratron.

+        /// </summary>

+        public static bool IsSepratron(this Part part)

+        {

+            return (part.IsSolidRocket() && part.ActivatesEvenIfDisconnected && part.IsDecoupledInStage(part.inverseStage));

+        }

+

+        /// <summary>

+        ///     Gets whether the part is a fuel line.

+        /// </summary>

+        public static bool IsFuelLine(this Part part)

+        {

+            return (part is FuelLine);

+        }

+

+        /// <summary>

+        ///     Gets whether the part is considered a primary part on the vessel.

+        /// </summary>

+        public static bool IsPrimary(this Part part, List<Part> partsList, PartModule module)

+        {

+            foreach (var vesselPart in partsList)

+            {

+                if (!vesselPart.HasModule(module.ClassID))

+                {

+                    continue;

+                }

+

+                if (vesselPart == part)

+                {

+                    return true;

+                }

+                break;

+            }

+

+            return false;

+        }

+

+        /// <summary>

+        ///     Gets whether the part has a one shot animation.

+        /// </summary>

+        public static bool HasOneShotAnimation(this Part part)

+        {

+            return part.HasModule<ModuleAnimateGeneric>() && part.GetModule<ModuleAnimateGeneric>().isOneShot;

+        }

+    }

 }
-

--- a/KerbalEngineer/Extensions/PartResourceExtensions.cs
+++ b/KerbalEngineer/Extensions/PartResourceExtensions.cs
@@ -1,36 +1,33 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using UnityEngine;
-
-namespace KerbalEngineer.Extensions
-{
-    public static class PartResourceExtensions
-    {
-        /// <summary>
-        /// Gets the definition object for the resource.
-        /// </summary>
-        public static PartResourceDefinition GetDefinition(this PartResource value)
-        {
-            return PartResourceLibrary.Instance.GetDefinition(value.info.id);
-        }
-
-        /// <summary>
-        /// Gets the density of the resource.
-        /// </summary>
-        public static double GetDensity(this PartResource value)
-        {
-            return value.GetDefinition().density;
-        }
-
-        /// <summary>
-        /// Gets the mass of the resource.
-        /// </summary>
-        public static double GetMass(this PartResource value)
-        {
-            return value.amount * value.GetDensity();
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+namespace KerbalEngineer.Extensions

+{

+    public static class PartResourceExtensions

+    {

+        /// <summary>

+        ///     Gets the definition object for the resource.

+        /// </summary>

+        public static PartResourceDefinition GetDefinition(this PartResource value)

+        {

+            return PartResourceLibrary.Instance.GetDefinition(value.info.id);

+        }

+

+        /// <summary>

+        ///     Gets the density of the resource.

+        /// </summary>

+        public static double GetDensity(this PartResource value)

+        {

+            return value.GetDefinition().density;

+        }

+

+        /// <summary>

+        ///     Gets the mass of the resource.

+        /// </summary>

+        public static double GetMass(this PartResource value)

+        {

+            return value.amount * value.GetDensity();

+        }

+    }

 }
-

--- a/KerbalEngineer/Extensions/RectExtensions.cs
+++ b/KerbalEngineer/Extensions/RectExtensions.cs
@@ -1,43 +1,45 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Settings;
-using UnityEngine;
-
-namespace KerbalEngineer.Extensions
-{
-    public static class RectExtensions
-    {
-        /// <summary>
-        /// Clamps the rectangle inside the screen region.
-        /// </summary>
-        public static Rect ClampInsideScreen(this Rect value)
-        {
-            value.x = Mathf.Clamp(value.x, 0f, Screen.width - value.width);
-            value.y = Mathf.Clamp(value.y, 0f, Screen.height - value.height);
-
-            return value;
-        }
-
-        /// <summary>
-        /// Clamps the rectangle into the screen region by the specified margin.
-        /// </summary>
-        public static Rect ClampToScreen(this Rect value, float margin = 25f)
-        {
-            value.x = Mathf.Clamp(value.x, -(value.width - margin), Screen.width - margin);
-            value.y = Mathf.Clamp(value.y, -(value.height - margin), Screen.height - margin);
-
-            return value;
-        }
-
-        /// <summary>
-        /// Returns whether the mouse is within the coordinates of this rectangle.
-        /// </summary>
-        public static bool MouseIsOver(this Rect value)
-        {
-            return value.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y));
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.Extensions

+{

+    public static class RectExtensions

+    {

+        /// <summary>

+        ///     Clamps the rectangle inside the screen region.

+        /// </summary>

+        public static Rect ClampInsideScreen(this Rect value)

+        {

+            value.x = Mathf.Clamp(value.x, 0, Screen.width - value.width);

+            value.y = Mathf.Clamp(value.y, 0, Screen.height - value.height);

+

+            return value;

+        }

+

+        /// <summary>

+        ///     Clamps the rectangle into the screen region by the specified margin.

+        /// </summary>

+        public static Rect ClampToScreen(this Rect value, float margin = 25.0f)

+        {

+            value.x = Mathf.Clamp(value.x, -(value.width - margin), Screen.width - margin);

+            value.y = Mathf.Clamp(value.y, -(value.height - margin), Screen.height - margin);

+

+            return value;

+        }

+

+        /// <summary>

+        ///     Returns whether the mouse is within the coordinates of this rectangle.

+        /// </summary>

+        public static bool MouseIsOver(this Rect value)

+        {

+            return value.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y));

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/EditDisplay.cs
+++ b/KerbalEngineer/FlightEngineer/EditDisplay.cs
@@ -1,338 +1,408 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.IO;
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class EditDisplay : MonoBehaviour
-    {
-        #region Fields
-
-        private Rect _windowPosition = new Rect(Screen.width / 2 - 250f, Screen.height / 2 - 250f, 500f, 500f);
-        private int _windowID = EngineerGlobals.GetNextWindowID();
-        private GUIStyle _windowStyle, _customControlBarStyle, _rowStyle, _buttonStyle, _textStyle, _titleStyle, _labelStyle;
-        private Vector2 _scrollAvailablePosition = Vector2.zero;
-        private Vector2 _scrollInstalledPosition = Vector2.zero;
-        private ReadoutCategory _selectedCategory = ReadoutCategory.None;
-
-        private bool _hasInitStyles = false;
-
-        #endregion
-
-        #region Properties
-
-        private bool _visible = false;
-        /// <summary>
-        /// Gets and sets the visibility of the window.
-        /// </summary>
-        public bool Visible
-        {
-            get { return _visible; }
-            set { _visible = value; }
-        }
-
-        private Section _section;
-        /// <summary>
-        /// Gets and sets the parent section.
-        /// </summary>
-        public Section Section
-        {
-            get { return _section; }
-            set { _section = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        // Initialises the gui styles upon request.
-        private void InitialiseStyles()
-        {
-            _hasInitStyles = true;
-
-            _windowStyle = new GUIStyle(HighLogic.Skin.window);
-
-            _customControlBarStyle = new GUIStyle();
-            _customControlBarStyle.fixedHeight = 25f;
-
-            _rowStyle = new GUIStyle();
-            _rowStyle.margin = new RectOffset(5, 5, 5, 5);
-            _rowStyle.fixedHeight = 25f;
-
-            _buttonStyle = new GUIStyle(HighLogic.Skin.button);
-            _buttonStyle.normal.textColor = Color.white;
-            _buttonStyle.fontSize = 11;
-            _buttonStyle.fontStyle = FontStyle.Bold;
-            _buttonStyle.stretchHeight = true;
-
-            _textStyle = new GUIStyle(HighLogic.Skin.textField);
-            _textStyle.alignment = TextAnchor.MiddleLeft;
-            _textStyle.fontSize = 12;
-            _textStyle.stretchWidth = true;
-            _textStyle.stretchHeight = true;
-
-            _titleStyle = new GUIStyle(HighLogic.Skin.label);
-            _titleStyle.normal.textColor = Color.white;
-            _titleStyle.alignment = TextAnchor.MiddleLeft;
-            _titleStyle.fontSize = 12;
-            _titleStyle.fontStyle = FontStyle.Bold;
-            _titleStyle.stretchWidth = true;
-
-            _labelStyle = new GUIStyle(HighLogic.Skin.label);
-            _labelStyle.normal.textColor = Color.white;
-            _labelStyle.alignment = TextAnchor.MiddleLeft;
-            _labelStyle.fontSize = 12;
-            _labelStyle.fontStyle = FontStyle.Bold;
-            _labelStyle.stretchHeight = true;
-            _labelStyle.stretchWidth = true;
-        }
-
-        #endregion
-
-        #region Drawing
-
-        // Runs when the object is called to draw.
-        public void Draw()
-        {
-            if (_visible)
-            {
-                if (!_hasInitStyles) InitialiseStyles();
-
-                _windowPosition = GUILayout.Window(_windowID, _windowPosition, Window, "EDIT SECTION - " + _section.Title.ToUpper(), _windowStyle).ClampToScreen();
-            }
-        }
-
-        private void Window(int windowID)
-        {
-            // Selected category has not been selected.
-            if (_selectedCategory == ReadoutCategory.None)
-            {
-                // Set selected category to first category.
-                if (_section.Categories.Count > 0)
-                    _selectedCategory = _section.Categories[0];
-            }
-
-            // Show user controls if the section was user created.
-            if (_section.IsUser)
-                UserControls();
-
-            // Show categories selection if there is more than one.
-            if (_section.Categories.Count > 1)
-                Categories();
-
-            Available(_selectedCategory);
-            Installed();
-
-            // Detach and close buttons.
-            GUILayout.BeginHorizontal(GUILayout.Height(30f));
-            if (GUILayout.Toggle(_section.Window.Visible, "DETACH INTO WINDOW", _buttonStyle, GUILayout.Width(150f)) != _section.Window.Visible)
-            {
-                _section.Window.Visible = !_section.Window.Visible;
-                FlightDisplay.Instance.RequireResize = true;
-            }
-            if (GUILayout.Button("CLOSE EDITOR", _buttonStyle)) _visible = false;
-            GUILayout.EndHorizontal();
-
-            GUI.DragWindow();
-        }
-
-        // Draws the user section controls.
-        private void UserControls()
-        {
-            GUILayout.BeginHorizontal(_customControlBarStyle);
-
-            GUILayout.BeginVertical(GUILayout.Width(50f));
-            GUILayout.Label("TITLE - ", _labelStyle);
-            GUILayout.EndVertical();
-
-            // Title text box.
-            GUILayout.BeginVertical();
-            _section.Title = GUILayout.TextField(_section.Title, _textStyle);
-            GUILayout.EndVertical();
-
-            // Delete button and handling.
-            GUILayout.BeginVertical(GUILayout.Width(100f));
-            if (GUILayout.Button("DELETE", _buttonStyle))
-            {
-                // Remove objects from lists and render queues.
-                SectionList.Instance.UserSections.Remove(_section);
-                FlightController.Instance.RequireResize = true;
-                if (_section.Visible)
-                    FlightDisplay.Instance.RequireResize = true;
-                RenderingManager.RemoveFromPostDrawQueue(0, Draw);
-                RenderingManager.RemoveFromPostDrawQueue(0, _section.Window.Draw);
-
-                // Delete the settings file.
-                if (File.Exists(EngineerGlobals.AssemblyPath + "Settings/Sections/" + _section.FileName))
-                    File.Delete(EngineerGlobals.AssemblyPath + "Settings/Sections/" + _section.FileName);
-
-                // Set MonoBehaviour objects to be destroyed.
-                Destroy(_section.Window);
-                Destroy(this);
-
-                print("[KerbalEngineer]: Deleted " + _section.Title + " section.");
-            }
-            GUILayout.EndVertical();
-
-            GUILayout.EndHorizontal();
-        }
-
-        // Draws the available categories selection.
-        private void Categories()
-        {
-            GUILayout.BeginHorizontal(GUILayout.Height(30f));
-            foreach (ReadoutCategory category in _section.Categories)
-            {
-                bool isSelected = _selectedCategory == category;
-                if (GUILayout.Toggle(isSelected, category.ToString().ToUpper(), _buttonStyle) && !isSelected)
-                    _selectedCategory = category;
-            }
-            GUILayout.EndHorizontal();
-        }
-
-        // Draws the available readouts panel.
-        private void Available(ReadoutCategory category)
-        {
-            GUI.skin = HighLogic.Skin;
-            _scrollAvailablePosition = GUILayout.BeginScrollView(_scrollAvailablePosition, false, true, GUILayout.Height(150f));
-            GUI.skin = null;
-
-            // Panel title.
-            GUILayout.Label("AVAILABLE", _titleStyle);
-
-            GUILayout.BeginVertical();
-            int count = 0;
-            foreach (Readout readout in ReadoutList.Instance.GetCategory(category))
-            {
-                // Readout is already installed.
-                if (_section.Readouts.Contains(readout)) continue;
-
-                count++;
-
-                GUILayout.BeginHorizontal(_rowStyle);
-
-                // Readout name.
-                GUILayout.BeginVertical();
-                GUILayout.Label(readout.Name, _labelStyle);
-                GUILayout.EndVertical();
-
-                // Info button.
-                GUILayout.BeginVertical(GUILayout.Width(30f));
-                if (GUILayout.Button("?", _buttonStyle))
-                {
-                    InfoDisplay.Instance.Readout = readout;
-                    InfoDisplay.Instance.Visible = true;
-                }
-                GUILayout.EndVertical();
-
-                // Install button
-                GUILayout.BeginVertical(GUILayout.Width(100f));
-                if (GUILayout.Button("INSTALL", _buttonStyle))
-                    _section.Readouts.Add(readout);
-                GUILayout.EndVertical();
-
-                GUILayout.EndHorizontal();
-            }
-
-            // Panel is void of readouts.
-            if (count == 0)
-            {
-                GUILayout.BeginHorizontal(_rowStyle);
-                GUILayout.Label("All readouts are installed!", _labelStyle);
-                GUILayout.EndHorizontal();
-            }
-
-            GUILayout.EndVertical();
-            GUILayout.EndScrollView();
-
-            // Insert space between available and installed panels.
-            GUILayout.Space(5f);
-        }
-
-        // Draws the installed readouts panel.
-        private void Installed()
-        {
-            GUI.skin = HighLogic.Skin;
-            _scrollInstalledPosition = GUILayout.BeginScrollView(_scrollInstalledPosition, false, true);
-            GUI.skin = null;
-
-            // Panel title
-            GUILayout.Label("INSTALLED", _titleStyle);
-
-            GUILayout.BeginVertical();
-            foreach (Readout readout in _section.Readouts)
-            {
-                GUILayout.BeginHorizontal(_rowStyle);
-
-                // Readout name.
-                GUILayout.BeginVertical();
-                GUILayout.Label(readout.Name, _labelStyle);
-                GUILayout.EndVertical();
-
-                // Move position up button.
-                GUILayout.BeginVertical(GUILayout.Width(30f));
-                if (GUILayout.Button("▲", _buttonStyle))
-                {
-                    int index = _section.Readouts.IndexOf(readout);
-                    if (index > 0)
-                    {
-                        _section.Readouts[index] = _section.Readouts[index - 1];
-                        _section.Readouts[index - 1] = readout;
-                    }
-                }
-                GUILayout.EndVertical();
-
-                // Move position down button.
-                GUILayout.BeginVertical(GUILayout.Width(30f));
-                if (GUILayout.Button("▼", _buttonStyle))
-                {
-                    int index = _section.Readouts.IndexOf(readout);
-                    if (index < _section.Readouts.Count - 1)
-                    {
-                        _section.Readouts[index] = _section.Readouts[index + 1];
-                        _section.Readouts[index + 1] = readout;
-                    }
-                }
-                GUILayout.EndVertical();
-
-                // Info button.
-                GUILayout.BeginVertical(GUILayout.Width(30f));
-                if (GUILayout.Button("?", _buttonStyle))
-                {
-                    InfoDisplay.Instance.Readout = readout;
-                    InfoDisplay.Instance.Visible = true;
-                }
-                GUILayout.EndVertical();
-
-                // Remove button.
-                GUILayout.BeginVertical(GUILayout.Width(100f));
-                if (GUILayout.Button("REMOVE", _buttonStyle))
-                {
-                    _section.Readouts.Remove(readout);
-                    FlightDisplay.Instance.RequireResize = true;
-                }
-                GUILayout.EndVertical();
-
-                GUILayout.EndHorizontal();
-            }
-
-            // Panel is void of readouts.
-            if (_section.Readouts.Count == 0)
-            {
-                GUILayout.BeginHorizontal(_rowStyle);
-                GUILayout.Label("No readouts are installed!", _labelStyle);
-                GUILayout.EndHorizontal();
-            }
-
-            GUILayout.EndVertical();
-            GUILayout.EndScrollView();
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.IO;

+

+using KerbalEngineer.Extensions;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class EditDisplay : MonoBehaviour

+    {

+        #region Fields

+

+        private readonly int windowId = EngineerGlobals.GetNextWindowId();

+

+        private Vector2 scrollAvailablePosition = Vector2.zero;

+        private Vector2 scrollInstalledPosition = Vector2.zero;

+        private ReadoutCategory selectedCategory = ReadoutCategory.None;

+        private Rect windowPosition = new Rect(Screen.width * 0.5f - 250.0f, Screen.height * 0.5f - 250.0f, 500.0f, 500.0f);

+

+        #region Styles

+

+        private GUIStyle buttonStyle;

+        private GUIStyle customControlBarStyle;

+        private GUIStyle labelStyle;

+        private GUIStyle rowStyle;

+        private GUIStyle textStyle;

+        private GUIStyle titleStyle;

+        private GUIStyle windowStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Properties

+

+        private Section section;

+        private bool visible;

+

+        /// <summary>

+        ///     Gets and sets the visibility of the window.

+        /// </summary>

+        public bool Visible

+        {

+            get { return this.visible; }

+            set { this.visible = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the parent section.

+        /// </summary>

+        public Section Section

+        {

+            get { return this.section; }

+            set { this.section = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        private void Start()

+        {

+            this.InitialiseStyles();

+        }

+

+        /// <summary>

+        ///     Initialises the GUI styles upon request.

+        /// </summary>

+        private void InitialiseStyles()

+        {

+            this.windowStyle = new GUIStyle(HighLogic.Skin.window);

+

+            this.customControlBarStyle = new GUIStyle

+            {

+                fixedHeight = 25.0f

+            };

+

+            this.rowStyle = new GUIStyle

+            {

+                margin = new RectOffset(5, 5, 5, 5),

+                fixedHeight = 25.0f

+            };

+

+            this.buttonStyle = new GUIStyle(HighLogic.Skin.button)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                stretchHeight = true

+            };

+

+            this.textStyle = new GUIStyle(HighLogic.Skin.textField)

+            {

+                alignment = TextAnchor.MiddleLeft,

+                fontSize = 12,

+                stretchWidth = true,

+                stretchHeight = true

+            };

+

+            this.titleStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                alignment = TextAnchor.MiddleLeft,

+                fontSize = 12,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+

+            this.labelStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                alignment = TextAnchor.MiddleLeft,

+                fontSize = 12,

+                fontStyle = FontStyle.Bold,

+                stretchHeight = true,

+                stretchWidth = true

+            };

+        }

+

+        #endregion

+

+        #region Drawing

+

+        /// <summary>

+        ///     Runs when the object is called to draw.

+        /// </summary>

+        public void Draw()

+        {

+            if (this.visible)

+            {

+                this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, "EDIT SECTION - " + this.section.Title.ToUpper(), this.windowStyle).ClampToScreen();

+            }

+        }

+

+        private void Window(int windowId)

+        {

+            // Selected category has not been selected.

+            if (this.selectedCategory == ReadoutCategory.None)

+            {

+                // Set selected category to first category.

+                if (this.section.Categories.Count > 0)

+                {

+                    this.selectedCategory = this.section.Categories[0];

+                }

+            }

+

+            // Show user controls if the section was user created.

+            if (this.section.IsUser)

+            {

+                this.UserControls();

+            }

+

+            // Show categories selection if there is more than one.

+            if (this.section.Categories.Count > 1)

+            {

+                this.Categories();

+            }

+

+            this.Available(this.selectedCategory);

+            this.Installed();

+

+            // Detach and close buttons.

+            GUILayout.BeginHorizontal(GUILayout.Height(30.0f));

+            if (GUILayout.Toggle(this.section.Window.Visible, "DETACH INTO WINDOW", this.buttonStyle, GUILayout.Width(150.0f)) != this.section.Window.Visible)

+            {

+                this.section.Window.Visible = !this.section.Window.Visible;

+                FlightDisplay.Instance.RequireResize = true;

+            }

+            if (GUILayout.Button("CLOSE EDITOR", this.buttonStyle))

+            {

+                this.visible = false;

+            }

+            GUILayout.EndHorizontal();

+

+            GUI.DragWindow();

+        }

+

+        /// <summary>

+        ///     Draws the user section controls.

+        /// </summary>

+        private void UserControls()

+        {

+            GUILayout.BeginHorizontal(this.customControlBarStyle);

+

+            GUILayout.BeginVertical(GUILayout.Width(50.0f));

+            GUILayout.Label("TITLE - ", this.labelStyle);

+            GUILayout.EndVertical();

+

+            // Title text box.

+            GUILayout.BeginVertical();

+            this.section.Title = GUILayout.TextField(this.section.Title, this.textStyle);

+            GUILayout.EndVertical();

+

+            // Delete button and handling.

+            GUILayout.BeginVertical(GUILayout.Width(100.0f));

+            if (GUILayout.Button("DELETE", this.buttonStyle))

+            {

+                // Remove objects from lists and render queues.

+                SectionList.Instance.UserSections.Remove(this.section);

+                FlightController.Instance.RequireResize = true;

+                if (this.section.Visible)

+                {

+                    FlightDisplay.Instance.RequireResize = true;

+                }

+                RenderingManager.RemoveFromPostDrawQueue(0, this.Draw);

+                RenderingManager.RemoveFromPostDrawQueue(0, this.section.Window.Draw);

+

+                // Delete the settings file.

+                if (File.Exists(EngineerGlobals.AssemblyPath + "Settings/Sections/" + this.section.FileName))

+                {

+                    File.Delete(EngineerGlobals.AssemblyPath + "Settings/Sections/" + this.section.FileName);

+                }

+

+                // Set MonoBehaviour objects to be destroyed.

+                Destroy(this.section.Window);

+                Destroy(this);

+

+                print("[KerbalEngineer]: Deleted " + this.section.Title + " section.");

+            }

+            GUILayout.EndVertical();

+

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws the available categories selection.

+        /// </summary>

+        private void Categories()

+        {

+            GUILayout.BeginHorizontal(GUILayout.Height(30.0f));

+            foreach (var category in this.section.Categories)

+            {

+                var isSelected = this.selectedCategory == category;

+                if (GUILayout.Toggle(isSelected, category.ToString().ToUpper(), this.buttonStyle) && !isSelected)

+                {

+                    this.selectedCategory = category;

+                }

+            }

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws the available readouts panel.

+        /// </summary>

+        private void Available(ReadoutCategory category)

+        {

+            GUI.skin = HighLogic.Skin;

+            this.scrollAvailablePosition = GUILayout.BeginScrollView(this.scrollAvailablePosition, false, true, GUILayout.Height(150f));

+            GUI.skin = null;

+

+            // Panel title.

+            GUILayout.Label("AVAILABLE", this.titleStyle);

+

+            GUILayout.BeginVertical();

+            var count = 0;

+            foreach (var readout in ReadoutList.Instance.GetCategory(category))

+            {

+                // Readout is already installed.

+                if (this.section.Readouts.Contains(readout))

+                {

+                    continue;

+                }

+

+                count++;

+

+                GUILayout.BeginHorizontal(this.rowStyle);

+

+                // Readout name.

+                GUILayout.BeginVertical();

+                GUILayout.Label(readout.Name, this.labelStyle);

+                GUILayout.EndVertical();

+

+                // Info button.

+                GUILayout.BeginVertical(GUILayout.Width(30.0f));

+                if (GUILayout.Button("?", this.buttonStyle))

+                {

+                    InfoDisplay.Instance.Readout = readout;

+                    InfoDisplay.Instance.Visible = true;

+                }

+                GUILayout.EndVertical();

+

+                // Install button

+                GUILayout.BeginVertical(GUILayout.Width(100.0f));

+                if (GUILayout.Button("INSTALL", this.buttonStyle))

+                {

+                    this.section.Readouts.Add(readout);

+                }

+                GUILayout.EndVertical();

+

+                GUILayout.EndHorizontal();

+            }

+

+            // Panel is void of readouts.

+            if (count == 0)

+            {

+                GUILayout.BeginHorizontal(this.rowStyle);

+                GUILayout.Label("All readouts are installed!", this.labelStyle);

+                GUILayout.EndHorizontal();

+            }

+

+            GUILayout.EndVertical();

+            GUILayout.EndScrollView();

+

+            // Insert space between available and installed panels.

+            GUILayout.Space(5f);

+        }

+

+        /// <summary>

+        ///     Draws the installed readouts panel.

+        /// </summary>

+        private void Installed()

+        {

+            GUI.skin = HighLogic.Skin;

+            this.scrollInstalledPosition = GUILayout.BeginScrollView(this.scrollInstalledPosition, false, true);

+            GUI.skin = null;

+

+            // Panel title

+            GUILayout.Label("INSTALLED", this.titleStyle);

+

+            GUILayout.BeginVertical();

+            foreach (var readout in this.section.Readouts)

+            {

+                GUILayout.BeginHorizontal(this.rowStyle);

+

+                // Readout name.

+                GUILayout.BeginVertical();

+                GUILayout.Label(readout.Name, this.labelStyle);

+                GUILayout.EndVertical();

+

+                // Move position up button.

+                GUILayout.BeginVertical(GUILayout.Width(30.0f));

+                if (GUILayout.Button("▲", this.buttonStyle))

+                {

+                    var index = this.section.Readouts.IndexOf(readout);

+                    if (index > 0)

+                    {

+                        this.section.Readouts[index] = this.section.Readouts[index - 1];

+                        this.section.Readouts[index - 1] = readout;

+                    }

+                }

+                GUILayout.EndVertical();

+

+                // Move position down button.

+                GUILayout.BeginVertical(GUILayout.Width(30.0f));

+                if (GUILayout.Button("▼", this.buttonStyle))

+                {

+                    var index = this.section.Readouts.IndexOf(readout);

+                    if (index < this.section.Readouts.Count - 1)

+                    {

+                        this.section.Readouts[index] = this.section.Readouts[index + 1];

+                        this.section.Readouts[index + 1] = readout;

+                    }

+                }

+                GUILayout.EndVertical();

+

+                // Info button.

+                GUILayout.BeginVertical(GUILayout.Width(30.0f));

+                if (GUILayout.Button("?", this.buttonStyle))

+                {

+                    InfoDisplay.Instance.Readout = readout;

+                    InfoDisplay.Instance.Visible = true;

+                }

+                GUILayout.EndVertical();

+

+                // Remove button.

+                GUILayout.BeginVertical(GUILayout.Width(100.0f));

+                if (GUILayout.Button("REMOVE", this.buttonStyle))

+                {

+                    this.section.Readouts.Remove(readout);

+                    FlightDisplay.Instance.RequireResize = true;

+                }

+                GUILayout.EndVertical();

+

+                GUILayout.EndHorizontal();

+            }

+

+            // Panel is void of readouts.

+            if (this.section.Readouts.Count == 0)

+            {

+                GUILayout.BeginHorizontal(this.rowStyle);

+                GUILayout.Label("No readouts are installed!", this.labelStyle);

+                GUILayout.EndHorizontal();

+            }

+

+            GUILayout.EndVertical();

+            GUILayout.EndScrollView();

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/FlightController.cs
+++ b/KerbalEngineer/FlightEngineer/FlightController.cs
@@ -1,278 +1,303 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.Collections.Generic;
-using System.IO;
-using KerbalEngineer.Settings;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class FlightController
-    {
-        #region Instance
-
-        private static FlightController _instance;
-        /// <summary>
-        /// Gets the current instance of the flight controller.
-        /// </summary>
-        public static FlightController Instance
-        {
-            get
-            {
-                if (_instance == null)
-                    _instance = new FlightController();
-
-                return _instance;
-            }
-        }
-
-        #endregion
-
-        #region Fields
-
-        private Rect _windowPosition = new Rect(Screen.width / 2f + 150f, 0f, 200f, 0f);
-        private Rect _handlePosition = new Rect(Screen.width / 2f + 200f, 0f, 100f, 17f);
-        private GUIStyle _windowStyle, _buttonStyle;
-        private Texture2D _closedNormal = new Texture2D(100, 17, TextureFormat.RGBA32, false);
-        private Texture2D _closedHover = new Texture2D(100, 17, TextureFormat.RGBA32, false);
-        private Texture2D _closedDown = new Texture2D(100, 17, TextureFormat.RGBA32, false);
-        private Texture2D _openNormal = new Texture2D(100, 17, TextureFormat.RGBA32, false);
-        private Texture2D _openHover = new Texture2D(100, 17, TextureFormat.RGBA32, false);
-        private Texture2D _openDown = new Texture2D(100, 17, TextureFormat.RGBA32, false);
-        private int _windowID = EngineerGlobals.GetNextWindowID();
-
-        private bool _hasInitStyles = false;
-        private bool _clicked = false;
-        private bool _open = false;
-        private float _openAmount = 0f;
-
-        #endregion
-
-        #region Properties
-
-        private bool _requireResize = false;
-        /// <summary>
-        /// Gets and sets whether the display requires a resize.
-        /// </summary>
-        public bool RequireResize
-        {
-            get { return _requireResize; }
-            set { _requireResize = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        private FlightController()
-        {
-            // Load textures directly from the PNG files. (Would of used GameDatabase but it compresses them so it looks shit!)
-            _closedNormal.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/ClosedNormal.png"));
-            _closedHover.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/ClosedHover.png"));
-            _closedDown.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/ClosedDown.png"));
-            _openNormal.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/OpenNormal.png"));
-            _openHover.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/OpenHover.png"));
-            _openDown.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/OpenDown.png"));
-        }
-
-        private void InitialiseStyles()
-        {
-            _hasInitStyles = true;
-
-            _windowStyle = new GUIStyle(HighLogic.Skin.window);
-            _windowStyle.margin = new RectOffset();
-            _windowStyle.padding = new RectOffset(3, 3, 3, 3);
-            _windowStyle.fixedWidth = _windowPosition.width;
-
-            _buttonStyle = new GUIStyle(HighLogic.Skin.button);
-            _buttonStyle.normal.textColor = Color.white;
-            _buttonStyle.margin = new RectOffset();
-            _buttonStyle.fixedHeight = 20f;
-            _buttonStyle.fontSize = 11;
-            _buttonStyle.fontStyle = FontStyle.Bold;
-        }
-
-        #endregion
-
-        #region Update and Drawing
-
-        public void Update()
-        {
-            // Controls the sliding animation.
-            if (_open && _openAmount < 1f) // Opening
-            {
-                _openAmount += ((10f * (1f - _openAmount)) + 0.5f) * Time.deltaTime;
-
-                if (_openAmount > 1f)
-                    _openAmount = 1f;
-            }
-            else if (!_open && _openAmount > 0f) // Closing
-            {
-                _openAmount -= ((10f * _openAmount) + 0.5f) * Time.deltaTime;
-
-                if (_openAmount < 0f)
-                    _openAmount = 0f;
-            }
-
-            // Set the sliding positions.
-            _windowPosition.y = -_windowPosition.height * (1f - _openAmount);
-            _handlePosition.y = _windowPosition.y + _windowPosition.height;
-        }
-
-        public void Draw()
-        {
-            if (!_hasInitStyles) InitialiseStyles();
-
-            // Handle window resizing if something has changed within the GUI.
-            if (_requireResize)
-            {
-                _requireResize = false;
-                _windowPosition.height = 0f;
-            }
-
-            DrawButton();
-
-            if (_windowPosition.y + _windowPosition.height > 0f || _windowPosition.height == 0f)
-                _windowPosition = GUILayout.Window(_windowID, _windowPosition, Window, string.Empty, _windowStyle);
-        }
-
-        private void Window(int windowID)
-        {
-            // Control bar toggle.
-            FlightDisplay.Instance.ControlBar = GUILayout.Toggle(FlightDisplay.Instance.ControlBar, "CONTROL BAR", _buttonStyle);
-
-            GUILayout.BeginHorizontal(); // Begin fixed sections.
-
-            // Draw fixed section display toggles.
-            GUILayout.BeginVertical();
-            foreach (Section section in SectionList.Instance.FixedSections)
-                section.Visible = GUILayout.Toggle(section.Visible, section.Title.ToUpper(), _buttonStyle);
-            GUILayout.EndVertical();
-
-            // Draw fixed section edit toggles.
-            GUILayout.BeginVertical(GUILayout.Width(50f));
-            foreach (Section section in SectionList.Instance.FixedSections)
-                section.EditDisplay.Visible = GUILayout.Toggle(section.EditDisplay.Visible, "EDIT", _buttonStyle);
-            GUILayout.EndVertical();
-
-            GUILayout.EndHorizontal(); // End fixed sections.
-            GUILayout.BeginHorizontal(); // Begin user sections.
-
-            // Draw user section display toggles.
-            GUILayout.BeginVertical();
-            foreach (Section section in SectionList.Instance.UserSections)
-            {
-                section.Visible = GUILayout.Toggle(section.Visible, section.Title.ToUpper(), _buttonStyle);
-            }
-            GUILayout.EndVertical();
-
-            // Draw user section edit toggles.
-            GUILayout.BeginVertical(GUILayout.Width(50f));
-            foreach (Section section in SectionList.Instance.UserSections)
-                section.EditDisplay.Visible = GUILayout.Toggle(section.EditDisplay.Visible, "EDIT", _buttonStyle);
-            GUILayout.EndVertical();
-
-            GUILayout.EndHorizontal(); // End user sections.
-
-            // New custom user section button.
-            if (GUILayout.Button("NEW USER SECTION", _buttonStyle))
-                SectionList.Instance.UserSections.Add(new Section(true));
-        }
-
-        private void DrawButton()
-        {
-            if (_clicked) // Button has been clicked whilst being hovered.
-            {
-                if (_open)
-                    GUI.DrawTexture(_handlePosition, _openDown);
-                else
-                    GUI.DrawTexture(_handlePosition, _closedDown);
-
-                if (_handlePosition.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.
-                {
-                    if (Mouse.Left.GetButtonUp()) // The mouse up event has been triggered whilst over the button.
-                    {
-                        _clicked = false;
-                        _open = !_open;
-                    }
-                }
-            }
-            else // The button is not registering as being clicked.
-            {
-                if (_handlePosition.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.
-                {
-                    // If the left mouse button has just been pressed, see the button as being clicked.
-                    if (!_clicked && (Mouse.Left.GetButtonDown())) _clicked = true;
-
-                    if (_clicked) // The button has just been clicked.
-                    {
-                        if (_open)
-                            GUI.DrawTexture(_handlePosition, _openDown);
-                        else
-                            GUI.DrawTexture(_handlePosition, _closedDown);
-                    }
-                    else if (!Mouse.Left.GetButton()) // Mouse button is not down and is just hovering.
-                    {
-                        if (_open)
-                            GUI.DrawTexture(_handlePosition, _openHover);
-                        else
-                            GUI.DrawTexture(_handlePosition, _closedHover);
-                    }
-                    else // Mouse button is down but no click was registered over the button.
-                    {
-                        if (_open)
-                            GUI.DrawTexture(_handlePosition, _openNormal);
-                        else
-                            GUI.DrawTexture(_handlePosition, _closedNormal);
-                    }
-                }
-                else // The mouse is not being hovered.
-                {
-                    if (_open)
-                        GUI.DrawTexture(_handlePosition, _openNormal);
-                    else
-                        GUI.DrawTexture(_handlePosition, _closedNormal);
-                }
-            }
-
-            // Check for an unclick event whilst the mouse is not hovering.
-            if (_clicked && (Mouse.Left.GetButtonUp())) _clicked = false;
-        }
-
-        #endregion
-
-        #region Save and Load
-
-        // Saves the settings associated with the flight controller.
-        public void Save()
-        {
-            try
-            {
-                SettingList list = new SettingList();
-                list.AddSetting("open", _open);
-                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/FlightController", list);
-
-                MonoBehaviour.print("[KerbalEngineer/FlightController]: Successfully saved settings.");
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightController]: Failed to save settings."); }
-        }
-
-        // Loads the settings associated with the flight controller.
-        public void Load()
-        {
-            try
-            {
-                SettingList list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/FlightController");
-                _open = (bool)list.GetSetting("open", _open);
-
-                MonoBehaviour.print("[KerbalEngineer/FlightController]: Successfully loaded settings.");
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightController]: Failed to load settings."); }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.IO;

+

+using KerbalEngineer.Settings;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class FlightController

+    {

+        #region Instance

+

+        private static FlightController _instance;

+

+        /// <summary>

+        ///     Gets the current instance of the flight controller.

+        /// </summary>

+        public static FlightController Instance

+        {

+            get { return _instance ?? (_instance = new FlightController()); }

+        }

+

+        #endregion

+

+        #region Fields

+

+        private readonly Texture2D closedDown = new Texture2D(100, 17, TextureFormat.RGBA32, false);

+        private readonly Texture2D closedHover = new Texture2D(100, 17, TextureFormat.RGBA32, false);

+        private readonly Texture2D closedNormal = new Texture2D(100, 17, TextureFormat.RGBA32, false);

+        private readonly Texture2D openDown = new Texture2D(100, 17, TextureFormat.RGBA32, false);

+        private readonly Texture2D openHover = new Texture2D(100, 17, TextureFormat.RGBA32, false);

+        private readonly Texture2D openNormal = new Texture2D(100, 17, TextureFormat.RGBA32, false);

+        private readonly int windowId = EngineerGlobals.GetNextWindowId();

+

+        private bool clicked;

+        private Rect handlePosition = new Rect(Screen.width * 0.5f + 200.0f, 0, 100.0f, 17.0f);

+        private bool open;

+        private float openAmount;

+        private Rect windowPosition = new Rect(Screen.width * 0.5f + 150.0f, 0, 200.0f, 0);

+

+        #region Styles

+

+        private GUIStyle buttonStyle;

+        private GUIStyle windowStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Properties

+

+        private bool requireResize;

+

+        /// <summary>

+        ///     Gets and sets whether the display requires a resize.

+        /// </summary>

+        public bool RequireResize

+        {

+            get { return this.requireResize; }

+            set { this.requireResize = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        private FlightController()

+        {

+            // Load textures directly from the PNG files. (Would of used GameDatabase but it compresses them so it looks shit!)

+            this.closedNormal.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/ClosedNormal.png"));

+            this.closedHover.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/ClosedHover.png"));

+            this.closedDown.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/ClosedDown.png"));

+            this.openNormal.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/OpenNormal.png"));

+            this.openHover.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/OpenHover.png"));

+            this.openDown.LoadImage(File.ReadAllBytes(EngineerGlobals.AssemblyPath + "GUI/FlightButton/OpenDown.png"));

+

+            this.InitialiseStyles();

+        }

+

+        private void InitialiseStyles()

+        {

+            this.windowStyle = new GUIStyle(HighLogic.Skin.window)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset(3, 3, 3, 3),

+                fixedWidth = this.windowPosition.width

+            };

+

+            this.buttonStyle = new GUIStyle(HighLogic.Skin.button)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                margin = new RectOffset(),

+                fixedHeight = 20.0f,

+                fontSize = 11,

+                fontStyle = FontStyle.Bold

+            };

+        }

+

+        #endregion

+

+        #region Update and Drawing

+

+        public void Update()

+        {

+            // Controls the sliding animation.

+            if (this.open && this.openAmount < 1f) // Opening

+            {

+                this.openAmount += ((10.0f * (1.0f - this.openAmount)) + 0.5f) * Time.deltaTime;

+

+                if (this.openAmount > 1.0f)

+                {

+                    this.openAmount = 1.0f;

+                }

+            }

+            else if (!this.open && this.openAmount > 0f) // Closing

+            {

+                this.openAmount -= ((10.0f * this.openAmount) + 0.5f) * Time.deltaTime;

+

+                if (this.openAmount < 0)

+                {

+                    this.openAmount = 0;

+                }

+            }

+

+            // Set the sliding positions.

+            this.windowPosition.y = -this.windowPosition.height * (1.0f - this.openAmount);

+            this.handlePosition.y = this.windowPosition.y + this.windowPosition.height;

+        }

+

+        public void Draw()

+        {

+            // Handle window resizing if something has changed within the GUI.

+            if (this.requireResize)

+            {

+                this.requireResize = false;

+                this.windowPosition.height = 0;

+            }

+

+            this.DrawButton();

+

+            if (this.windowPosition.y + this.windowPosition.height > 0 || this.windowPosition.height == 0)

+            {

+                this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, string.Empty, this.windowStyle);

+            }

+        }

+

+        private void Window(int windowId)

+        {

+            // Control bar toggle.

+            FlightDisplay.Instance.ControlBar = GUILayout.Toggle(FlightDisplay.Instance.ControlBar, "CONTROL BAR", this.buttonStyle);

+

+            GUILayout.BeginHorizontal(); // Begin fixed sections.

+

+            // Draw fixed section display toggles.

+            GUILayout.BeginVertical();

+            foreach (var section in SectionList.Instance.FixedSections)

+            {

+                section.Visible = GUILayout.Toggle(section.Visible, section.Title.ToUpper(), this.buttonStyle);

+            }

+            GUILayout.EndVertical();

+

+            // Draw fixed section edit toggles.

+            GUILayout.BeginVertical(GUILayout.Width(50.0f));

+            foreach (var section in SectionList.Instance.FixedSections)

+            {

+                section.EditDisplay.Visible = GUILayout.Toggle(section.EditDisplay.Visible, "EDIT", this.buttonStyle);

+            }

+            GUILayout.EndVertical();

+

+            GUILayout.EndHorizontal(); // End fixed sections.

+            GUILayout.BeginHorizontal(); // Begin user sections.

+

+            // Draw user section display toggles.

+            GUILayout.BeginVertical();

+            foreach (var section in SectionList.Instance.UserSections)

+            {

+                section.Visible = GUILayout.Toggle(section.Visible, section.Title.ToUpper(), this.buttonStyle);

+            }

+            GUILayout.EndVertical();

+

+            // Draw user section edit toggles.

+            GUILayout.BeginVertical(GUILayout.Width(50f));

+            foreach (var section in SectionList.Instance.UserSections)

+            {

+                section.EditDisplay.Visible = GUILayout.Toggle(section.EditDisplay.Visible, "EDIT", this.buttonStyle);

+            }

+            GUILayout.EndVertical();

+

+            GUILayout.EndHorizontal(); // End user sections.

+

+            // New custom user section button.

+            if (GUILayout.Button("NEW USER SECTION", this.buttonStyle))

+            {

+                SectionList.Instance.UserSections.Add(new Section(true));

+            }

+        }

+

+        private void DrawButton()

+        {

+            if (this.clicked) // Button has been clicked whilst being hovered.

+            {

+                GUI.DrawTexture(this.handlePosition, this.open ? this.openDown : this.closedDown);

+

+                if (this.handlePosition.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.

+                {

+                    if (Mouse.Left.GetButtonUp()) // The mouse up event has been triggered whilst over the button.

+                    {

+                        this.clicked = false;

+                        this.open = !this.open;

+                    }

+                }

+            }

+            else // The button is not registering as being clicked.

+            {

+                if (this.handlePosition.Contains(Event.current.mousePosition)) // Mouse is hovering over the button.

+                {

+                    // If the left mouse button has just been pressed, see the button as being clicked.

+                    if (!this.clicked && (Mouse.Left.GetButtonDown()))

+                    {

+                        this.clicked = true;

+                    }

+

+                    if (this.clicked) // The button has just been clicked.

+                    {

+                        GUI.DrawTexture(this.handlePosition, this.open ? this.openDown : this.closedDown);

+                    }

+                    else if (!Mouse.Left.GetButton()) // Mouse button is not down and is just hovering.

+                    {

+                        GUI.DrawTexture(this.handlePosition, this.open ? this.openHover : this.closedHover);

+                    }

+                    else // Mouse button is down but no click was registered over the button.

+                    {

+                        GUI.DrawTexture(this.handlePosition, this.open ? this.openNormal : this.closedNormal);

+                    }

+                }

+                else // The mouse is not being hovered.

+                {

+                    GUI.DrawTexture(this.handlePosition, this.open ? this.openNormal : this.closedNormal);

+                }

+            }

+

+            // Check for an unclick event whilst the mouse is not hovering.

+            if (this.clicked && (Mouse.Left.GetButtonUp()))

+            {

+                this.clicked = false;

+            }

+        }

+

+        #endregion

+

+        #region Save and Load

+

+        /// <summary>

+        ///     Saves the settings associated with the flight controller.

+        /// </summary>

+        public void Save()

+        {

+            try

+            {

+                var list = new SettingList();

+                list.AddSetting("open", this.open);

+                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/FlightController", list);

+

+                MonoBehaviour.print("[KerbalEngineer/FlightController]: Successfully saved settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightController]: Failed to save settings.");

+            }

+        }

+

+        /// <summary>

+        ///     Loads the settings associated with the flight controller.

+        /// </summary>

+        public void Load()

+        {

+            try

+            {

+                var list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/FlightController");

+                this.open = (bool)list.GetSetting("open", this.open);

+

+                MonoBehaviour.print("[KerbalEngineer/FlightController]: Successfully loaded settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightController]: Failed to load settings.");

+            }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/FlightDisplay.cs
+++ b/KerbalEngineer/FlightEngineer/FlightDisplay.cs
@@ -1,193 +1,228 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Settings;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class FlightDisplay
-    {
-        #region Instance
-
-        private static FlightDisplay _instance;
-        /// <summary>
-        /// Gets the current instance of the flight display.
-        /// </summary>
-        public static FlightDisplay Instance
-        {
-            get
-            {
-                if (_instance == null)
-                    _instance = new FlightDisplay();
-
-                return _instance;
-            }
-        }
-
-        #endregion
-
-        #region Fields
-
-        private GUIStyle _windowStyle, _buttonStyle, _titleStyle;
-        private int _windowID = EngineerGlobals.GetNextWindowID();
-
-        private bool _hasInitStyles = false;
-
-        #endregion
-
-        #region Properties
-
-        private Rect _windowPosition = new Rect(Screen.width / 2f - 125f, 100f, 250f, 0f);
-        /// <summary>
-        /// Gets and sets the window position.
-        /// </summary>
-        public Rect WindowPosition
-        {
-            get { return _windowPosition; }
-            set { _windowPosition = value; }
-        }
-
-        private bool _requireResize = false;
-        /// <summary>
-        /// Gets and sets whether the window requires a resize.
-        /// </summary>
-        public bool RequireResize
-        {
-            get { return _requireResize; }
-            set { _requireResize = value; }
-        }
-
-        private bool _controlBar = true;
-        /// <summary>
-        /// Gets and sets the visibility of the control bar.
-        /// </summary>
-        public bool ControlBar
-        {
-            get { return _controlBar; }
-            set
-            {
-                if (_controlBar && !value)
-                    _requireResize = true;
-
-                _controlBar = value;
-            }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        private void InitialiseStyles()
-        {
-            _hasInitStyles = true;
-
-            _windowStyle = new GUIStyle(HighLogic.Skin.window);
-            _windowStyle.margin = new RectOffset();
-            _windowStyle.padding = new RectOffset(5, 5, 3, 5);
-            _windowStyle.fixedWidth = 270f;
-
-            _buttonStyle = new GUIStyle(HighLogic.Skin.button);
-            _buttonStyle.normal.textColor = Color.white;
-            _buttonStyle.fontSize = 11;
-            _buttonStyle.fontStyle = FontStyle.Bold;
-
-            _titleStyle = new GUIStyle(HighLogic.Skin.label);
-            _titleStyle.alignment = TextAnchor.MiddleCenter;
-            _titleStyle.fontSize = 13;
-            _titleStyle.fontStyle = FontStyle.Bold;
-            _titleStyle.stretchWidth = true;
-        }
-
-        #endregion
-
-        #region Update and Drawing
-
-        public void Update()
-        {
-        }
-
-        public void Draw()
-        {
-            if ((SectionList.Instance.HasVisibleSections && SectionList.Instance.HasAttachedSections) || _controlBar)
-            {
-                if (!_hasInitStyles) InitialiseStyles();
-
-                // Handle window resizing if something has changed within the GUI.
-                if (_requireResize)
-                {
-                    _requireResize = false;
-                    _windowPosition.width = 0f;
-                    _windowPosition.height = 0f;
-                }
-
-                _windowPosition = GUILayout.Window(_windowID, _windowPosition, Window, string.Empty, _windowStyle).ClampToScreen();
-            }
-        }
-
-        private void Window(int windowID)
-        {
-            // Draw control bar.
-            if (_controlBar)
-            {
-                GUILayout.Label("FLIGHT ENGINEER " + EngineerGlobals.AssemblyVersion, _titleStyle);
-                GUILayout.BeginHorizontal();
-                foreach (Section section in SectionList.Instance.FixedSections)
-                    section.Visible = GUILayout.Toggle(section.Visible, section.ShortTitle, _buttonStyle, GUILayout.Height(25f));
-                GUILayout.EndHorizontal();
-            }
-
-            // Draw all visible fixed sections.
-            foreach (Section section in SectionList.Instance.FixedSections)
-                if (section.Visible && !section.Window.Visible)
-                    section.Draw();
-
-            // Draw all visible user sections.
-            foreach (Section section in SectionList.Instance.UserSections)
-                if (section.Visible && !section.Window.Visible)
-                    section.Draw();
-
-            GUI.DragWindow();
-        }
-
-        #endregion
-
-        #region Save and Load
-
-        // Saves the settings associated with the flight display.
-        public void Save()
-        {
-            try
-            {
-                SettingList list = new SettingList();
-                list.AddSetting("x", _windowPosition.x);
-                list.AddSetting("y", _windowPosition.y);
-                list.AddSetting("controlBar", _controlBar);
-                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/FlightDisplay", list);
-                
-                MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Successfully saved settings.");
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Failed to save settings."); }
-        }
-
-        // Loads the settings associated with the flight display.
-        public void Load()
-        {
-            try
-            {
-                SettingList list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/FlightDisplay");
-                _windowPosition.x = (float)list.GetSetting("x", _windowPosition.x);
-                _windowPosition.y = (float)list.GetSetting("y", _windowPosition.y);
-                _controlBar = (bool)list.GetSetting("controlBar", _controlBar);
-
-                MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Successfully loaded settings.");
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Failed to load settings."); }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+using KerbalEngineer.Settings;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class FlightDisplay

+    {

+        #region Instance

+

+        private static FlightDisplay _instance;

+

+        /// <summary>

+        ///     Gets the current instance of the flight display.

+        /// </summary>

+        public static FlightDisplay Instance

+        {

+            get { return _instance ?? (_instance = new FlightDisplay()); }

+        }

+

+        #endregion

+

+        #region Fields

+

+        private readonly int windowId = EngineerGlobals.GetNextWindowId();

+

+        #region Styles

+

+        private GUIStyle buttonStyle;

+        private GUIStyle titleStyle;

+        private GUIStyle windowStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Properties

+

+        private bool controlBar = true;

+        private bool requireResize;

+        private Rect windowPosition = new Rect(Screen.width * 0.5f - 125.0f, 100.0f, 250.0f, 0);

+

+        /// <summary>

+        ///     Gets and sets the window position.

+        /// </summary>

+        public Rect WindowPosition

+        {

+            get { return this.windowPosition; }

+            set { this.windowPosition = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether the window requires a resize.

+        /// </summary>

+        public bool RequireResize

+        {

+            get { return this.requireResize; }

+            set { this.requireResize = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the visibility of the control bar.

+        /// </summary>

+        public bool ControlBar

+        {

+            get { return this.controlBar; }

+            set

+            {

+                if (this.controlBar && !value)

+                {

+                    this.requireResize = true;

+                }

+

+                this.controlBar = value;

+            }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        public FlightDisplay()

+        {

+            this.InitialiseStyles();

+        }

+

+        private void InitialiseStyles()

+        {

+            this.windowStyle = new GUIStyle(HighLogic.Skin.window)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset(5, 5, 3, 5),

+                fixedWidth = 270.0f

+            };

+

+            this.buttonStyle = new GUIStyle(HighLogic.Skin.button)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 11,

+                fontStyle = FontStyle.Bold

+            };

+

+            this.titleStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                alignment = TextAnchor.MiddleCenter,

+                fontSize = 13,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+        }

+

+        #endregion

+

+        #region Update and Drawing

+

+        public void Update() { }

+

+        public void Draw()

+        {

+            if ((SectionList.Instance.HasVisibleSections && SectionList.Instance.HasAttachedSections) || this.controlBar)

+            {

+                // Handle window resizing if something has changed within the GUI.

+                if (this.requireResize)

+                {

+                    this.requireResize = false;

+                    this.windowPosition.width = 0;

+                    this.windowPosition.height = 0;

+                }

+

+                this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, string.Empty, this.windowStyle).ClampToScreen();

+            }

+        }

+

+        private void Window(int windowId)

+        {

+            // Draw control bar.

+            if (this.controlBar)

+            {

+                GUILayout.Label("FLIGHT ENGINEER " + EngineerGlobals.AssemblyVersion, this.titleStyle);

+                GUILayout.BeginHorizontal();

+                foreach (var section in SectionList.Instance.FixedSections)

+                {

+                    section.Visible = GUILayout.Toggle(section.Visible, section.ShortTitle, this.buttonStyle, GUILayout.Height(25.0f));

+                }

+                GUILayout.EndHorizontal();

+            }

+

+            // Draw all visible fixed sections.

+            foreach (var section in SectionList.Instance.FixedSections)

+            {

+                if (section.Visible && !section.Window.Visible)

+                {

+                    section.Draw();

+                }

+            }

+

+            // Draw all visible user sections.

+            foreach (var section in SectionList.Instance.UserSections)

+            {

+                if (section.Visible && !section.Window.Visible)

+                {

+                    section.Draw();

+                }

+            }

+

+            GUI.DragWindow();

+        }

+

+        #endregion

+

+        #region Save and Load

+

+        /// <summary>

+        ///     Saves the settings associated with the flight display.

+        /// </summary>

+        public void Save()

+        {

+            try

+            {

+                var list = new SettingList();

+                list.AddSetting("x", this.windowPosition.x);

+                list.AddSetting("y", this.windowPosition.y);

+                list.AddSetting("controlBar", this.controlBar);

+                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/FlightDisplay", list);

+

+                MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Successfully saved settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Failed to save settings.");

+            }

+        }

+

+        /// <summary>

+        ///     Loads the settings associated with the flight display.

+        /// </summary>

+        public void Load()

+        {

+            try

+            {

+                var list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/FlightDisplay");

+                this.windowPosition.x = (float)list.GetSetting("x", this.windowPosition.x);

+                this.windowPosition.y = (float)list.GetSetting("y", this.windowPosition.y);

+                this.controlBar = (bool)list.GetSetting("controlBar", this.controlBar);

+

+                MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Successfully loaded settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightDisplay]: Failed to load settings.");

+            }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/FlightEngineer.cs
+++ b/KerbalEngineer/FlightEngineer/FlightEngineer.cs
@@ -1,81 +1,92 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Settings;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class FlightEngineer : PartModule
-    {
-        #region Initialisation
-
-        public void Start()
-        {
-            if (HighLogic.LoadedSceneIsFlight)
-                RenderingManager.AddToPostDrawQueue(0, OnDraw);
-        }
-
-        #endregion
-
-        #region Update and Drawing
-
-        public void Update()
-        {
-            if (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel == this.vessel && this.part.IsPrimary(this.vessel.parts, this))
-            {
-                SectionList.Instance.Update();
-                FlightController.Instance.Update();
-                FlightDisplay.Instance.Update();
-            }
-        }
-
-        public void OnDraw()
-        {
-            if (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel == this.vessel && this.part.IsPrimary(this.vessel.parts, this))
-            {
-                FlightController.Instance.Draw();
-                FlightDisplay.Instance.Draw();
-            }
-        }
-
-        #endregion
-
-        #region Save and Load
-
-        // Saves the settings when the module is set to save.
-        public override void OnSave(ConfigNode node)
-        {
-            try
-            {
-                if (HighLogic.LoadedSceneIsFlight)
-                {
-                    SectionList.Instance.Save();
-                    FlightController.Instance.Save();
-                    FlightDisplay.Instance.Save();
-                }
-            }
-            catch { }
-        }
-
-        // Loads the settings when the module is set to load.
-        public override void OnLoad(ConfigNode node)
-        {
-            try
-            {
-                if (HighLogic.LoadedSceneIsFlight)
-                {
-                    SectionList.Instance.Load();
-                    FlightController.Instance.Load();
-                    FlightDisplay.Instance.Load();
-                }
-            }
-            catch { }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class FlightEngineer : PartModule

+    {

+        #region Initialisation

+

+        public void Start()

+        {

+            if (HighLogic.LoadedSceneIsFlight)

+            {

+                RenderingManager.AddToPostDrawQueue(0, this.OnDraw);

+            }

+        }

+

+        #endregion

+

+        #region Update and Drawing

+

+        public void Update()

+        {

+            if (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel == this.vessel && this.part.IsPrimary(this.vessel.parts, this))

+            {

+                SectionList.Instance.Update();

+                FlightController.Instance.Update();

+                FlightDisplay.Instance.Update();

+            }

+        }

+

+        public void OnDraw()

+        {

+            if (HighLogic.LoadedSceneIsFlight && FlightGlobals.ActiveVessel == this.vessel && this.part.IsPrimary(this.vessel.parts, this))

+            {

+                FlightController.Instance.Draw();

+                FlightDisplay.Instance.Draw();

+            }

+        }

+

+        #endregion

+

+        #region Save and Load

+

+        /// <summary>

+        ///     Saves the settings when the module is told to save.

+        /// </summary>

+        public override void OnSave(ConfigNode node)

+        {

+            if (!HighLogic.LoadedSceneIsFlight)

+            {

+                return;

+            }

+

+            try

+            {

+                SectionList.Instance.Save();

+                FlightController.Instance.Save();

+                FlightDisplay.Instance.Save();

+            }

+            catch { }

+        }

+

+        /// <summary>

+        ///     Loads the settings when the module is told to load.

+        /// </summary>

+        public override void OnLoad(ConfigNode node)

+        {

+            if (!HighLogic.LoadedSceneIsFlight)

+            {

+                return;

+            }

+

+            try

+            {

+                SectionList.Instance.Load();

+                FlightController.Instance.Load();

+                FlightDisplay.Instance.Load();

+            }

+            catch { }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/InfoDisplay.cs
+++ b/KerbalEngineer/FlightEngineer/InfoDisplay.cs
@@ -1,140 +1,159 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class InfoDisplay : MonoBehaviour
-    {
-        #region Instance
-
-        private static InfoDisplay _instance;
-        /// <summary>
-        /// Gets the current instance of the InfoDisplay object.
-        /// </summary>
-        public static InfoDisplay Instance
-        {
-            get
-            {
-                if (_instance == null)
-                    _instance = HighLogic.fetch.gameObject.AddComponent<InfoDisplay>();
-
-                return _instance;
-            }
-        }
-
-        #endregion
-
-        #region Fields
-
-        private Rect _windowPosition = new Rect(Screen.width / 2 - 150f, Screen.height / 2 - 100f, 300f, 200f);
-        private int _windowID = EngineerGlobals.GetNextWindowID();
-        private GUIStyle _windowStyle, _infoStyle, _buttonStyle, _labelStyle;
-        private Vector2 _scrollPosition = Vector2.zero;
-
-        private bool _hasInitStyles = false;
-
-        #endregion
-
-        #region Properties
-
-        private bool _visible = false;
-        /// <summary>
-        /// Gets and sets whether the display is visible.
-        /// </summary>
-        public bool Visible
-        {
-            get { return _visible; }
-            set { _visible = value; }
-        }
-
-
-        private Readout _readout;
-        /// <summary>
-        /// Gets and sets the information to be displayed.
-        /// </summary>
-        public Readout Readout
-        {
-            get { return _readout; }
-            set { _readout = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        // Runs when the object is created.
-        private void Start()
-        {
-            RenderingManager.AddToPostDrawQueue(0, Draw);
-        }
-
-        // Initialises the gui styles upon request.
-        private void InitialiseStyles()
-        {
-            _hasInitStyles = true;
-
-            _windowStyle = new GUIStyle(HighLogic.Skin.window);
-
-            _infoStyle = new GUIStyle();
-            _infoStyle.margin = new RectOffset(5, 5, 5, 5);
-
-            _buttonStyle = new GUIStyle(HighLogic.Skin.button);
-            _buttonStyle.normal.textColor = Color.white;
-            _buttonStyle.fontSize = 11;
-            _buttonStyle.fontStyle = FontStyle.Bold;
-            _buttonStyle.stretchWidth = true;
-
-            _labelStyle = new GUIStyle(HighLogic.Skin.label);
-            _labelStyle.normal.textColor = Color.white;
-            _labelStyle.alignment = TextAnchor.MiddleLeft;
-            _labelStyle.fontSize = 12;
-            _labelStyle.fontStyle = FontStyle.Bold;
-            _labelStyle.stretchWidth = true;
-        }
-
-        #endregion
-
-        #region Drawing
-
-        // Runs when the object is called to draw.
-        private void Draw()
-        {
-            if (_visible)
-            {
-                if (!_hasInitStyles) InitialiseStyles();
-
-                _windowPosition = GUILayout.Window(_windowID, _windowPosition, Window, "READOUT INFORMATION", _windowStyle).ClampToScreen();
-            }
-        }
-
-        private void Window(int windowID)
-        {
-            GUI.skin = HighLogic.Skin;
-            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, true);
-            GUI.skin = null;
-
-            if (_readout != null)
-            {
-                GUILayout.Label(_readout.Name, _labelStyle);
-
-                GUILayout.BeginHorizontal(_infoStyle);
-                GUILayout.Label(_readout.Description, _labelStyle);
-                GUILayout.EndHorizontal();
-            }
-
-            GUILayout.EndScrollView();
-
-            if (GUILayout.Button("CLOSE", _buttonStyle))
-                _visible = false;
-
-            GUI.DragWindow();
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class InfoDisplay : MonoBehaviour

+    {

+        #region Instance

+

+        private static InfoDisplay _instance;

+

+        /// <summary>

+        ///     Gets the current instance of the InfoDisplay object.

+        /// </summary>

+        public static InfoDisplay Instance

+        {

+            get { return _instance ?? (_instance = HighLogic.fetch.gameObject.AddComponent<InfoDisplay>()); }

+        }

+

+        #endregion

+

+        #region Fields

+

+        private readonly int windowId = EngineerGlobals.GetNextWindowId();

+

+        private Vector2 scrollPosition = Vector2.zero;

+        private Rect windowPosition = new Rect(Screen.width * 0.5f - 150.0f, Screen.height * 0.5f - 100.0f, 300.0f, 200.0f);

+

+        #region Styles

+

+        private GUIStyle buttonStyle;

+        private GUIStyle infoStyle;

+        private GUIStyle labelStyle;

+        private GUIStyle windowStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Properties

+

+        private Readout readout;

+        private bool visible;

+

+        /// <summary>

+        ///     Gets and sets whether the display is visible.

+        /// </summary>

+        public bool Visible

+        {

+            get { return this.visible; }

+            set { this.visible = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the information to be displayed.

+        /// </summary>

+        public Readout Readout

+        {

+            get { return this.readout; }

+            set { this.readout = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        // Runs when the object is created.

+        private void Start()

+        {

+            this.InitialiseStyles();

+            RenderingManager.AddToPostDrawQueue(0, this.Draw);

+        }

+

+        // Initialises the gui styles upon request.

+        private void InitialiseStyles()

+        {

+            this.windowStyle = new GUIStyle(HighLogic.Skin.window);

+

+            this.infoStyle = new GUIStyle

+            {

+                margin = new RectOffset(5, 5, 5, 5)

+            };

+

+            this.buttonStyle = new GUIStyle(HighLogic.Skin.button)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 11,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+

+            this.labelStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                alignment = TextAnchor.MiddleLeft,

+                fontSize = 12,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+        }

+

+        #endregion

+

+        #region Drawing

+

+        /// <summary>

+        ///     Runs when the object is called to draw.

+        /// </summary>

+        private void Draw()

+        {

+            if (this.visible)

+            {

+                this.windowPosition = GUILayout.Window(this.windowId, this.windowPosition, this.Window, "READOUT INFORMATION", this.windowStyle).ClampToScreen();

+            }

+        }

+

+        private void Window(int windowId)

+        {

+            GUI.skin = HighLogic.Skin;

+            this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, false, true);

+            GUI.skin = null;

+

+            if (this.readout != null)

+            {

+                GUILayout.Label(this.readout.Name, this.labelStyle);

+

+                GUILayout.BeginHorizontal(this.infoStyle);

+                GUILayout.Label(this.readout.Description, this.labelStyle);

+                GUILayout.EndHorizontal();

+            }

+

+            GUILayout.EndScrollView();

+

+            if (GUILayout.Button("CLOSE", this.buttonStyle))

+            {

+                this.visible = false;

+            }

+

+            GUI.DragWindow();

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/ApoapsisHeight.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/ApoapsisHeight.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class ApoapsisHeight : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Apoapsis Height";
-            Description = "Shows the apoapsis height from sea level.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.ApA.ToDistance());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class ApoapsisHeight : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Apoapsis Height";

+            this.Description = "Shows the apoapsis height from sea level.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.ApA.ToDistance());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/Eccentricity.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/Eccentricity.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class Eccentricity : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Eccentricity";
-            Description = "Shows your current eccentricity.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.eccentricity.ToAngle());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class Eccentricity : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Eccentricity";

+            this.Description = "Shows your current eccentricity.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.eccentricity.ToAngle());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/Inclination.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/Inclination.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class Inclination : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Inclination";
-            Description = "Shows your current inclination.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.inclination.ToAngle());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class Inclination : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Inclination";

+            this.Description = "Shows your current inclination.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.inclination.ToAngle());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/LongitudeOfAN.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/LongitudeOfAN.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class LongitudeOfAN : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Longitude of AN";
-            Description = "Shows your longitude of the ascending node.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.LAN.ToAngle());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class LongitudeOfAN : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Longitude of AN";

+            this.Description = "Shows your longitude of the ascending node.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.LAN.ToAngle());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/LongitudeOfPe.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/LongitudeOfPe.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class LongitudeOfPe : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Longitude of Pe";
-            Description = "Shows your longitude of the periapsis.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine((FlightGlobals.ActiveVessel.orbit.LAN + FlightGlobals.ActiveVessel.orbit.argumentOfPeriapsis).ToAngle());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class LongitudeOfPe : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Longitude of Pe";

+            this.Description = "Shows your longitude of the periapsis.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine((FlightGlobals.ActiveVessel.orbit.LAN + FlightGlobals.ActiveVessel.orbit.argumentOfPeriapsis).ToAngle());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/OrbitalPeriod.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/OrbitalPeriod.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class OrbitalPeriod : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Orbital Period";
-            Description = "Shows your orbital period.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.period.ToTime());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class OrbitalPeriod : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Orbital Period";

+            this.Description = "Shows your orbital period.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.period.ToTime());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/PeriapsisHeight.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/PeriapsisHeight.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class PeriapsisHeight : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Periapsis Height";
-            Description = "Shows the periapsis height from sea level.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.PeA.ToDistance());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class PeriapsisHeight : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Periapsis Height";

+            this.Description = "Shows the periapsis height from sea level.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.PeA.ToDistance());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/SemiMajorAxis.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/SemiMajorAxis.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class SemiMajorAxis : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Semi-major Axis";
-            Description = "Shows your semi-major axis.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.semiMajorAxis.ToDistance());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class SemiMajorAxis : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Semi-major Axis";

+            this.Description = "Shows your semi-major axis.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.semiMajorAxis.ToDistance());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/SemiMinorAxis.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/SemiMinorAxis.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class SemiMinorAxis : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Semi-minor Axis";
-            Description = "Shows your semi-minor axis.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.semiMinorAxis.ToDistance());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class SemiMinorAxis : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Semi-minor Axis";

+            this.Description = "Shows your semi-minor axis.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.semiMinorAxis.ToDistance());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/TimeToApoapsis.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/TimeToApoapsis.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class TimeToApoapsis : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Time to Apoapsis";
-            Description = "Shows the time to apoapsis.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.timeToAp.ToTime());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class TimeToApoapsis : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Time to Apoapsis";

+            this.Description = "Shows the time to apoapsis.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.timeToAp.ToTime());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Orbital/TimeToPeriapsis.cs
+++ b/KerbalEngineer/FlightEngineer/Orbital/TimeToPeriapsis.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Orbital
-{
-    public class TimeToPeriapsis : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Time to Periapsis";
-            Description = "Shows the time to periapsis.";
-            Category = ReadoutCategory.Orbital;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.orbit.timeToPe.ToTime());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Orbital

+{

+    public class TimeToPeriapsis : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Time to Periapsis";

+            this.Description = "Shows the time to periapsis.";

+            this.Category = ReadoutCategory.Orbital;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.orbit.timeToPe.ToTime());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Readout.cs
+++ b/KerbalEngineer/FlightEngineer/Readout.cs
@@ -1,167 +1,198 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public enum ReadoutCategory
-    {
-        None,
-        Orbital,
-        Surface,
-        Vessel,
-        Rendezvous,
-        Misc
-    }
-
-    public abstract class Readout
-    {
-        #region Static Properties
-
-        // Width of the name column.
-        private static float _nameWidth = 125f;
-        public static float NameWidth
-        {
-            get { return _nameWidth; }
-        }
-
-        // Width of the data column.
-        private static float _dataWidth = 125f;
-        public static float DataWidth
-        {
-            get { return _dataWidth; }
-        }
-
-        #endregion
-
-        #region Properties
-
-        protected GUIStyle NameStyle { get; private set; }
-        protected GUIStyle DataStyle { get; private set; }
-        protected GUIStyle MsgStyle { get; private set; }
-
-        private string _name = string.Empty;
-        /// <summary>
-        /// Gets the readout name.
-        /// </summary>
-        public string Name
-        {
-            get { return _name; }
-            protected set { _name = value; }
-        }
-
-        private string _description = string.Empty;
-        /// <summary>
-        /// Gets the readout description.
-        /// </summary>
-        public string Description
-        {
-            get { return _description; }
-            protected set { _description = value; }
-        }
-
-        private ReadoutCategory _category = ReadoutCategory.Misc;
-        /// <summary>
-        /// Gets the category in which the readout is contained.
-        /// </summary>
-        public ReadoutCategory Category
-        {
-            get { return _category; }
-            protected set { _category = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        public Readout()
-        {   
-            InitialiseStyles();
-            Initialise();
-        }
-
-        private void InitialiseStyles()
-        {
-            NameStyle = new GUIStyle(HighLogic.Skin.label);
-            NameStyle.normal.textColor = Color.white;
-            NameStyle.margin = new RectOffset();
-            NameStyle.padding = new RectOffset(3, 3, 3, 3);
-            NameStyle.fontSize = 12;
-            NameStyle.fontStyle = FontStyle.Bold;
-            NameStyle.alignment = TextAnchor.MiddleLeft;
-            NameStyle.stretchWidth = true;
-
-            DataStyle = new GUIStyle(HighLogic.Skin.label);
-            DataStyle.margin = new RectOffset();
-            DataStyle.padding = new RectOffset(3, 3, 3, 3);
-            DataStyle.fontSize = 12;
-            DataStyle.fontStyle = FontStyle.Normal;
-            DataStyle.alignment = TextAnchor.MiddleRight;
-            DataStyle.stretchWidth = true;
-
-            MsgStyle = new GUIStyle(NameStyle);
-            MsgStyle.alignment = TextAnchor.MiddleCenter;
-        }
-
-        protected virtual void Initialise() { }
-
-        #endregion
-
-        #region Update and Draw
-
-        public virtual void Update() { }
-
-        public virtual void Draw() { }
-
-        /// <summary>
-        /// Draws a single line readout using the provided data.
-        /// </summary>
-        protected void DrawLine(string data)
-        {
-            GUILayout.BeginHorizontal();
-
-            GUILayout.BeginVertical(GUILayout.Width(NameWidth));
-            GUILayout.Label(Name, NameStyle);
-            GUILayout.EndVertical();
-
-            GUILayout.BeginVertical(GUILayout.Width(DataWidth));
-            GUILayout.Label(data, DataStyle);
-            GUILayout.EndVertical();
-
-            GUILayout.EndHorizontal();
-        }
-
-        /// <summary>
-        /// Draws a single line readout using the provided name and data.
-        /// </summary>
-        protected void DrawLine(string name, string data)
-        {
-            GUILayout.BeginHorizontal();
-
-            GUILayout.BeginVertical(GUILayout.Width(NameWidth));
-            GUILayout.Label(name, NameStyle);
-            GUILayout.EndVertical();
-
-            GUILayout.BeginVertical(GUILayout.Width(DataWidth));
-            GUILayout.Label(data, DataStyle);
-            GUILayout.EndVertical();
-
-            GUILayout.EndHorizontal();
-        }
-
-        /// <summary>
-        /// Draws a single line message that is centred.
-        /// </summary>
-        protected void DrawMessageLine(string message)
-        {
-            GUILayout.BeginHorizontal();
-            GUILayout.Label(message, MsgStyle);
-            GUILayout.EndHorizontal();
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public enum ReadoutCategory

+    {

+        None,

+        Orbital,

+        Surface,

+        Vessel,

+        Rendezvous,

+        Misc

+    }

+

+    public abstract class Readout

+    {

+        #region Static Properties

+

+        private static float _nameWidth = 125.0f;

+        private static float _dataWidth = 125.0f;

+

+        /// <summary>

+        ///     Width of the name column.

+        /// </summary>

+        public static float NameWidth

+        {

+            get { return _nameWidth; }

+            set { _nameWidth = value; }

+        }

+

+        /// <summary>

+        ///     Width of the data column.

+        /// </summary>

+        public static float DataWidth

+        {

+            get { return _dataWidth; }

+            set { _dataWidth = value; }

+        }

+

+        #endregion

+

+        #region Properties

+

+        private ReadoutCategory category = ReadoutCategory.Misc;

+        private string description = string.Empty;

+        private string name = string.Empty;

+

+        /// <summary>

+        ///     Gets the GUIStyle for the readout name.

+        /// </summary>

+        protected GUIStyle NameStyle { get; private set; }

+

+        /// <summary>

+        ///     Gets the GUIStyle for the readout data.

+        /// </summary>

+        protected GUIStyle DataStyle { get; private set; }

+

+        /// <summary>

+        ///     Gets the GUIStyle for readout messages.

+        /// </summary>

+        protected GUIStyle MsgStyle { get; private set; }

+

+        /// <summary>

+        ///     Gets the readout name.

+        /// </summary>

+        public string Name

+        {

+            get { return this.name; }

+            protected set { this.name = value; }

+        }

+

+        /// <summary>

+        ///     Gets the readout description.

+        /// </summary>

+        public string Description

+        {

+            get { return this.description; }

+            protected set { this.description = value; }

+        }

+

+        /// <summary>

+        ///     Gets the category in which the readout is contained.

+        /// </summary>

+        public ReadoutCategory Category

+        {

+            get { return this.category; }

+            protected set { this.category = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        protected Readout()

+        {

+            this.InitialiseStyles();

+            this.Initialise();

+        }

+

+        private void InitialiseStyles()

+        {

+            this.NameStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                margin = new RectOffset(),

+                padding = new RectOffset(3, 3, 3, 3),

+                fontSize = 12,

+                fontStyle = FontStyle.Bold,

+                alignment = TextAnchor.MiddleLeft,

+                stretchWidth = true

+            };

+

+            this.DataStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset(3, 3, 3, 3),

+                fontSize = 12,

+                fontStyle = FontStyle.Normal,

+                alignment = TextAnchor.MiddleRight,

+                stretchWidth = true

+            };

+

+            this.MsgStyle = new GUIStyle(this.NameStyle)

+            {

+                alignment = TextAnchor.MiddleCenter

+            };

+        }

+

+        protected virtual void Initialise() { }

+

+        #endregion

+

+        #region Update and Draw

+

+        public virtual void Update() { }

+

+        public virtual void Draw() { }

+

+        /// <summary>

+        ///     Draws a single line readout using the provided data.

+        /// </summary>

+        protected void DrawLine(string data)

+        {

+            GUILayout.BeginHorizontal();

+

+            GUILayout.BeginVertical(GUILayout.Width(_nameWidth));

+            GUILayout.Label(this.Name, this.NameStyle);

+            GUILayout.EndVertical();

+

+            GUILayout.BeginVertical(GUILayout.Width(_dataWidth));

+            GUILayout.Label(data, this.DataStyle);

+            GUILayout.EndVertical();

+

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws a single line readout using the provided name and data.

+        /// </summary>

+        protected void DrawLine(string name, string data)

+        {

+            GUILayout.BeginHorizontal();

+

+            GUILayout.BeginVertical(GUILayout.Width(_nameWidth));

+            GUILayout.Label(name, this.NameStyle);

+            GUILayout.EndVertical();

+

+            GUILayout.BeginVertical(GUILayout.Width(_dataWidth));

+            GUILayout.Label(data, this.DataStyle);

+            GUILayout.EndVertical();

+

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws a single line message that is centred.

+        /// </summary>

+        protected void DrawMessageLine(string message)

+        {

+            GUILayout.BeginHorizontal();

+            GUILayout.Label(message, this.MsgStyle);

+            GUILayout.EndHorizontal();

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/ReadoutList.cs
+++ b/KerbalEngineer/FlightEngineer/ReadoutList.cs
@@ -1,113 +1,108 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.Collections.Generic;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class ReadoutList
-    {
-        #region Instance
-
-        private static ReadoutList _instance;
-        /// <summary>
-        /// Gets the current instance of the readout list.
-        /// </summary>
-        public static ReadoutList Instance
-        {
-            get
-            {
-                if (_instance == null)
-                    _instance = new ReadoutList();
-
-                return _instance;
-            }
-        }
-
-        #endregion
-
-        #region Properties
-
-        private List<Readout> _readouts = new List<Readout>();
-        /// <summary>
-        /// Gets and sets the available readouts.
-        /// </summary>
-        public List<Readout> Readouts
-        {
-            get { return _readouts; }
-            set { _readouts = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        private ReadoutList()
-        {
-            _readouts.Add(new Orbital.ApoapsisHeight());
-            _readouts.Add(new Orbital.PeriapsisHeight());
-            _readouts.Add(new Orbital.TimeToApoapsis());
-            _readouts.Add(new Orbital.TimeToPeriapsis());
-            _readouts.Add(new Orbital.Inclination());
-            _readouts.Add(new Orbital.Eccentricity());
-            _readouts.Add(new Orbital.OrbitalPeriod());
-            _readouts.Add(new Orbital.LongitudeOfAN());
-            _readouts.Add(new Orbital.LongitudeOfPe());
-            _readouts.Add(new Orbital.SemiMajorAxis());
-            _readouts.Add(new Orbital.SemiMinorAxis());
-
-            _readouts.Add(new Surface.AltitudeSeaLevel());
-            _readouts.Add(new Surface.AltitudeTerrain());
-            _readouts.Add(new Surface.VerticalSpeed());
-            _readouts.Add(new Surface.HorizontalSpeed());
-            _readouts.Add(new Surface.Longitude());
-            _readouts.Add(new Surface.Latitude());
-            _readouts.Add(new Surface.TerminalVelocity());
-            _readouts.Add(new Surface.AtmosEfficiency());
-
-            _readouts.Add(new Vessel.DeltaVStaged());
-            _readouts.Add(new Vessel.DeltaVTotal());
-            _readouts.Add(new Vessel.SpecificImpulse());
-            _readouts.Add(new Vessel.TotalMass());
-            _readouts.Add(new Vessel.ThrustTotal());
-            _readouts.Add(new Vessel.ThrustActual());
-            _readouts.Add(new Vessel.ThrustToWeight());
-
-            _readouts.Add(new Rendezvous.TargetSelector());
-        }
-
-        #endregion
-
-        #region Public Methods
-
-        /// <summary>
-        /// Gets a readout matching the name provided.
-        /// </summary>
-        public Readout GetReadout(string name)
-        {
-            foreach (Readout readout in _readouts)
-                if (readout.Name == name)
-                    return readout;
-
-            return null;
-        }
-
-        /// <summary>
-        /// Gets a list of readouts based on the category provided.
-        /// </summary>
-        public List<Readout> GetCategory(ReadoutCategory category)
-        {
-            List<Readout> readouts = new List<Readout>();
-
-            foreach (Readout readout in _readouts)
-                if (readout.Category == category)
-                    readouts.Add(readout);
-
-            return readouts;
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.Collections.Generic;

+using System.Linq;

+

+using KerbalEngineer.FlightEngineer.Orbital;

+using KerbalEngineer.FlightEngineer.Rendezvous;

+using KerbalEngineer.FlightEngineer.Surface;

+using KerbalEngineer.FlightEngineer.Vessel;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class ReadoutList

+    {

+        #region Instance

+

+        private static ReadoutList _instance;

+

+        /// <summary>

+        ///     Gets the current instance of the readout list.

+        /// </summary>

+        public static ReadoutList Instance

+        {

+            get { return _instance ?? (_instance = new ReadoutList()); }

+        }

+

+        #endregion

+

+        #region Properties

+

+        private List<Readout> readouts = new List<Readout>();

+

+        /// <summary>

+        ///     Gets and sets the available readouts.

+        /// </summary>

+        public List<Readout> Readouts

+        {

+            get { return this.readouts; }

+            set { this.readouts = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        private ReadoutList()

+        {

+            this.readouts.Add(new ApoapsisHeight());

+            this.readouts.Add(new PeriapsisHeight());

+            this.readouts.Add(new TimeToApoapsis());

+            this.readouts.Add(new TimeToPeriapsis());

+            this.readouts.Add(new Inclination());

+            this.readouts.Add(new Eccentricity());

+            this.readouts.Add(new OrbitalPeriod());

+            this.readouts.Add(new LongitudeOfAN());

+            this.readouts.Add(new LongitudeOfPe());

+            this.readouts.Add(new SemiMajorAxis());

+            this.readouts.Add(new SemiMinorAxis());

+

+            this.readouts.Add(new AltitudeSeaLevel());

+            this.readouts.Add(new AltitudeTerrain());

+            this.readouts.Add(new VerticalSpeed());

+            this.readouts.Add(new HorizontalSpeed());

+            this.readouts.Add(new Longitude());

+            this.readouts.Add(new Latitude());

+            this.readouts.Add(new TerminalVelocity());

+            this.readouts.Add(new AtmosEfficiency());

+

+            this.readouts.Add(new DeltaVStaged());

+            this.readouts.Add(new DeltaVTotal());

+            this.readouts.Add(new SpecificImpulse());

+            this.readouts.Add(new TotalMass());

+            this.readouts.Add(new ThrustTotal());

+            this.readouts.Add(new ThrustActual());

+            this.readouts.Add(new ThrustToWeight());

+

+            this.readouts.Add(new TargetSelector());

+        }

+

+        #endregion

+

+        #region Methods

+

+        /// <summary>

+        ///     Gets a readout matching the name provided.

+        /// </summary>

+        public Readout GetReadout(string name)

+        {

+            return this.readouts.FirstOrDefault(readout => readout.Name == name);

+        }

+

+        /// <summary>

+        ///     Gets a list of readouts based on the category provided.

+        /// </summary>

+        public List<Readout> GetCategory(ReadoutCategory category)

+        {

+            return this.readouts.Where(readout => readout.Category == category).ToList();

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Rendezvous/TargetSelector.cs
+++ b/KerbalEngineer/FlightEngineer/Rendezvous/TargetSelector.cs
@@ -1,305 +1,388 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Rendezvous
-{
-    public class TargetSelector : Readout
-    {
-        #region Fields
-
-        private GUIStyle _buttonStyle, _searchStyle;
-        private float _typeButtonWidth = 0f;
-        private string _searchQuery = string.Empty;
-        private string _searchText = string.Empty;
-        private bool _usingSearch = false;
-        private VesselType _vesselType = VesselType.Unknown;
-        private bool _typeIsBody = false;
-        private int _targetCount = 0;
-
-        #endregion
-
-        #region Initialisation
-
-        protected override void Initialise()
-        {
-            Name = "Target Selector";
-            Description = "A tool to allow easy browsing, searching and selection of targets.";
-            Category = ReadoutCategory.Rendezvous;
-            InitialiseStyles();
-        }
-
-        private void InitialiseStyles()
-        {
-            _buttonStyle = new GUIStyle(HighLogic.Skin.button);
-            _buttonStyle.normal.textColor = Color.white;
-            _buttonStyle.margin = new RectOffset();
-            _buttonStyle.padding = new RectOffset(5, 5, 5, 5);
-            _buttonStyle.fontSize = 11;
-            _buttonStyle.fontStyle = FontStyle.Bold;
-
-            _searchStyle = new GUIStyle(HighLogic.Skin.textField);
-            _searchStyle.stretchHeight = true;
-
-            _typeButtonWidth = Mathf.Round((Readout.NameWidth + Readout.DataWidth) / 2f);
-        }
-
-        #endregion
-
-        #region Drawing
-
-        // Draws the target selector structure.
-        public override void Draw()
-        {
-            if (FlightGlobals.fetch.VesselTarget == null)
-            {
-                if (_vesselType == VesselType.Unknown && !_typeIsBody)
-                {
-                    DrawSearch();
-                    if (_searchQuery.Length == 0)
-                        DrawTypes();
-                    else
-                        DrawTargetList();
-                }
-                else
-                {
-                    DrawBackToTypes();
-                    DrawTargetList();
-                }
-            }
-            else
-            {
-                DrawTarget();
-            }
-        }
-
-        // Draws the search bar.
-        private void DrawSearch()
-        {
-            GUILayout.BeginHorizontal(GUILayout.Height(30f));
-            GUILayout.BeginVertical(GUILayout.Width(75f));
-            GUILayout.Label("SEARCH:", NameStyle, GUILayout.ExpandHeight(true));
-            GUILayout.EndVertical();
-            GUILayout.BeginVertical();
-
-            _searchText = GUILayout.TextField(_searchText, _searchStyle);
-
-            if (_searchText.Length > 0 || _searchQuery.Length > 0)
-            {
-                _searchQuery = _searchText.ToLower();
-
-                if (!_usingSearch)
-                {
-                    _usingSearch = true;
-                    FlightDisplay.Instance.RequireResize = true;
-                }
-            }
-            else
-                if (_usingSearch)
-                    _usingSearch = false;
-
-            GUILayout.EndVertical();
-            GUILayout.EndHorizontal();
-        }
-
-        // Draws the button list of target types.
-        private void DrawTypes()
-        {
-            GUILayout.BeginHorizontal();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Celestial Bodies", _buttonStyle)) SetTypeAsBody();
-            GUILayout.EndVertical();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Debris", _buttonStyle)) SetTypeAs(VesselType.Debris);
-            GUILayout.EndVertical();
-            GUILayout.EndHorizontal();
-            GUILayout.BeginHorizontal();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Probes", _buttonStyle)) SetTypeAs(VesselType.Probe);
-            GUILayout.EndVertical();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Rovers", _buttonStyle)) SetTypeAs(VesselType.Rover);
-            GUILayout.EndVertical();
-            GUILayout.EndHorizontal();
-            GUILayout.BeginHorizontal();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Landers", _buttonStyle)) SetTypeAs(VesselType.Lander);
-            GUILayout.EndVertical();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Ships", _buttonStyle)) SetTypeAs(VesselType.Ship);
-            GUILayout.EndVertical();
-            GUILayout.EndHorizontal();
-            GUILayout.BeginHorizontal();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Stations", _buttonStyle)) SetTypeAs(VesselType.Station);
-            GUILayout.EndVertical();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Bases", _buttonStyle)) SetTypeAs(VesselType.Base);
-            GUILayout.EndVertical();
-            GUILayout.EndHorizontal();
-            GUILayout.BeginHorizontal();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("EVAs", _buttonStyle)) SetTypeAs(VesselType.EVA);
-            GUILayout.EndVertical();
-            GUILayout.BeginVertical(GUILayout.Width(_typeButtonWidth));
-            if (GUILayout.Button("Flags", _buttonStyle)) SetTypeAs(VesselType.Flag);
-            GUILayout.EndVertical();
-            GUILayout.EndHorizontal();
-        }
-
-        // Draws the target information when selected.
-        private void DrawTarget()
-        {
-            if (GUILayout.Button("Go Back to Target Selection", _buttonStyle))
-            {
-                FlightGlobals.fetch.SetVesselTarget(null);
-                FlightDisplay.Instance.RequireResize = true;
-            }
-
-            GUILayout.Space(3f);
-
-            DrawLine("Selected Target", FlightGlobals.fetch.VesselTarget.GetName());
-        }
-
-        // Draws back to types button.
-        private void DrawBackToTypes()
-        {
-            if (GUILayout.Button("Go Back to Type Selection", _buttonStyle))
-            {
-                _typeIsBody = false;
-                _vesselType = VesselType.Unknown;
-                FlightDisplay.Instance.RequireResize = true;
-            }
-
-            GUILayout.Space(3f);
-        }
-
-        // Draws the target list.
-        private void DrawTargetList()
-        {
-            int count = 0;
-
-            if (_searchQuery.Length == 0)
-            {
-                if (_typeIsBody)
-                {
-                    count += DrawMoons();
-                    count += DrawPlanets();
-                }
-                else
-                {
-                    count += DrawVessels();
-                }
-            }
-            else
-            {
-                count += DrawVessels();
-                count += DrawMoons();
-                count += DrawPlanets();
-            }
-
-            if (count == 0) DrawMessageLine("No targets found!");
-            if (count != _targetCount)
-            {
-                _targetCount = count;
-                FlightDisplay.Instance.RequireResize = true;
-            }
-        }
-
-        // Draws targettable moons.
-        private int DrawMoons()
-        {
-            int count = 0;
-            foreach (CelestialBody body in FlightGlobals.Bodies)
-            {
-                if (body == Planetarium.fetch.Sun) continue;
-
-                if (FlightGlobals.ActiveVessel.mainBody == body.referenceBody)
-                {
-                    if (_searchQuery.Length > 0 && !body.bodyName.ToLower().Contains(_searchQuery)) continue;
-
-                    count++;
-                    if (GUILayout.Button(body.bodyName, _buttonStyle))
-                        SetTargetAs(body);
-                }
-
-            }
-            return count;
-        }
-
-        // Draws targettable planets.
-        private int DrawPlanets()
-        {
-            int count = 0;
-            foreach (CelestialBody body in FlightGlobals.Bodies)
-            {
-                if (body == Planetarium.fetch.Sun || body == FlightGlobals.ActiveVessel.mainBody) continue;
-
-                if (FlightGlobals.ActiveVessel.mainBody.referenceBody == body.referenceBody)
-                {
-                    if (_searchQuery.Length > 0 && !body.bodyName.ToLower().Contains(_searchQuery)) continue;
-
-                    count++;
-                    if (GUILayout.Button(body.GetName(), _buttonStyle))
-                        SetTargetAs(body);
-                }
-            }
-            return count;
-        }
-
-        // Draws targettable vessels.
-        private int DrawVessels()
-        {
-            int count = 0;
-            foreach (global::Vessel vessel in FlightGlobals.Vessels)
-            {
-                if (vessel == FlightGlobals.ActiveVessel) continue;
-
-                if (_searchQuery.Length == 0)
-                {
-                    if (vessel.vesselType == _vesselType)
-                    {
-                        count++;
-                        if (GUILayout.Button(vessel.GetName(), _buttonStyle))
-                            SetTargetAs(vessel);
-                    }
-                }
-                else if (vessel.vesselName.ToLower().Contains(_searchQuery))
-                {
-                    count++;
-                    if (GUILayout.Button(vessel.GetName(), _buttonStyle))
-                        SetTargetAs(vessel);
-                }
-            }
-            return count;
-        }
-       
-
-        #endregion
-
-        #region Private Methods
-
-        private void SetTypeAs(VesselType vesselType)
-        {
-            _vesselType = vesselType;
-            SectionList.Instance.RequireResize = true;
-        }
-
-        private void SetTypeAsBody()
-        {
-            _typeIsBody = true;
-            SectionList.Instance.RequireResize = true;
-        }
-
-        private void SetTargetAs(ITargetable target)
-        {
-            FlightGlobals.fetch.SetVesselTarget(target);
-            SectionList.Instance.RequireResize = true;
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Rendezvous

+{

+    public class TargetSelector : Readout

+    {

+        #region Fields

+

+        private string searchQuery = string.Empty;

+        private string searchText = string.Empty;

+        private int targetCount;

+        private float typeButtonWidth;

+        private bool typeIsBody;

+        private bool usingSearch;

+        private VesselType vesselType = VesselType.Unknown;

+

+        #region Styles

+

+        private GUIStyle buttonStyle;

+        private GUIStyle searchStyle;

+

+        #endregion

+

+        #endregion

+

+        #region Initialisation

+

+        protected override void Initialise()

+        {

+            this.Name = "Target Selector";

+            this.Description = "A tool to allow easy browsing, searching and selection of targets.";

+            this.Category = ReadoutCategory.Rendezvous;

+            this.InitialiseStyles();

+        }

+

+        private void InitialiseStyles()

+        {

+            this.buttonStyle = new GUIStyle(HighLogic.Skin.button)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                margin = new RectOffset(),

+                padding = new RectOffset(5, 5, 5, 5),

+                fontSize = 11,

+                fontStyle = FontStyle.Bold

+            };

+

+            this.searchStyle = new GUIStyle(HighLogic.Skin.textField)

+            {

+                stretchHeight = true

+            };

+

+            this.typeButtonWidth = Mathf.Round((NameWidth + DataWidth) * 0.5f);

+        }

+

+        #endregion

+

+        #region Drawing

+

+        /// <summary>

+        ///     Draws the target selector structure.

+        /// </summary>

+        public override void Draw()

+        {

+            if (FlightGlobals.fetch.VesselTarget == null)

+            {

+                if (this.vesselType == VesselType.Unknown && !this.typeIsBody)

+                {

+                    this.DrawSearch();

+                    if (this.searchQuery.Length == 0)

+                    {

+                        this.DrawTypes();

+                    }

+                    else

+                    {

+                        this.DrawTargetList();

+                    }

+                }

+                else

+                {

+                    this.DrawBackToTypes();

+                    this.DrawTargetList();

+                }

+            }

+            else

+            {

+                this.DrawTarget();

+            }

+        }

+

+        /// <summary>

+        ///     Draws the search bar.

+        /// </summary>

+        private void DrawSearch()

+        {

+            GUILayout.BeginHorizontal(GUILayout.Height(30.0f));

+            GUILayout.BeginVertical(GUILayout.Width(75.0f));

+            GUILayout.Label("SEARCH:", this.NameStyle, GUILayout.ExpandHeight(true));

+            GUILayout.EndVertical();

+            GUILayout.BeginVertical();

+

+            this.searchText = GUILayout.TextField(this.searchText, this.searchStyle);

+

+            if (this.searchText.Length > 0 || this.searchQuery.Length > 0)

+            {

+                this.searchQuery = this.searchText.ToLower();

+

+                if (!this.usingSearch)

+                {

+                    this.usingSearch = true;

+                    FlightDisplay.Instance.RequireResize = true;

+                }

+            }

+            else if (this.usingSearch)

+            {

+                this.usingSearch = false;

+            }

+

+            GUILayout.EndVertical();

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws the button list of target types.

+        /// </summary>

+        private void DrawTypes()

+        {

+            GUILayout.BeginHorizontal();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Celestial Bodies", this.buttonStyle))

+            {

+                this.SetTypeAsBody();

+            }

+            GUILayout.EndVertical();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Debris", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Debris);

+            }

+            GUILayout.EndVertical();

+            GUILayout.EndHorizontal();

+            GUILayout.BeginHorizontal();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Probes", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Probe);

+            }

+            GUILayout.EndVertical();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Rovers", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Rover);

+            }

+            GUILayout.EndVertical();

+            GUILayout.EndHorizontal();

+            GUILayout.BeginHorizontal();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Landers", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Lander);

+            }

+            GUILayout.EndVertical();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Ships", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Ship);

+            }

+            GUILayout.EndVertical();

+            GUILayout.EndHorizontal();

+            GUILayout.BeginHorizontal();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Stations", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Station);

+            }

+            GUILayout.EndVertical();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Bases", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Base);

+            }

+            GUILayout.EndVertical();

+            GUILayout.EndHorizontal();

+            GUILayout.BeginHorizontal();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("EVAs", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.EVA);

+            }

+            GUILayout.EndVertical();

+            GUILayout.BeginVertical(GUILayout.Width(this.typeButtonWidth));

+            if (GUILayout.Button("Flags", this.buttonStyle))

+            {

+                this.SetTypeAs(VesselType.Flag);

+            }

+            GUILayout.EndVertical();

+            GUILayout.EndHorizontal();

+        }

+

+        /// <summary>

+        ///     Draws the target information when selected.

+        /// </summary>

+        private void DrawTarget()

+        {

+            if (GUILayout.Button("Go Back to Target Selection", this.buttonStyle))

+            {

+                FlightGlobals.fetch.SetVesselTarget(null);

+                FlightDisplay.Instance.RequireResize = true;

+            }

+

+            GUILayout.Space(3f);

+

+            this.DrawLine("Selected Target", FlightGlobals.fetch.VesselTarget.GetName());

+        }

+

+        /// <summary>

+        ///     Draws the back to types button.

+        /// </summary>

+        private void DrawBackToTypes()

+        {

+            if (GUILayout.Button("Go Back to Type Selection", this.buttonStyle))

+            {

+                this.typeIsBody = false;

+                this.vesselType = VesselType.Unknown;

+                FlightDisplay.Instance.RequireResize = true;

+            }

+

+            GUILayout.Space(3f);

+        }

+

+        /// <summary>

+        ///     Draws the target list.

+        /// </summary>

+        private void DrawTargetList()

+        {

+            var count = 0;

+

+            if (this.searchQuery.Length == 0)

+            {

+                if (this.typeIsBody)

+                {

+                    count += this.DrawMoons();

+                    count += this.DrawPlanets();

+                }

+                else

+                {

+                    count += this.DrawVessels();

+                }

+            }

+            else

+            {

+                count += this.DrawVessels();

+                count += this.DrawMoons();

+                count += this.DrawPlanets();

+            }

+

+            if (count == 0)

+            {

+                this.DrawMessageLine("No targets found!");

+            }

+

+            if (count != this.targetCount)

+            {

+                this.targetCount = count;

+                FlightDisplay.Instance.RequireResize = true;

+            }

+        }

+

+        /// <summary>

+        ///     Draws targetable moons.

+        /// </summary>

+        private int DrawMoons()

+        {

+            var count = 0;

+

+            foreach (var body in FlightGlobals.Bodies)

+            {

+                if (FlightGlobals.ActiveVessel.mainBody != body.referenceBody || body == Planetarium.fetch.Sun)

+                {

+                    continue;

+                }

+

+                if (this.searchQuery.Length > 0 && !body.bodyName.ToLower().Contains(this.searchQuery))

+                {

+                    continue;

+                }

+

+                count++;

+                if (GUILayout.Button(body.bodyName, this.buttonStyle))

+                {

+                    this.SetTargetAs(body);

+                }

+            }

+            return count;

+        }

+

+        /// <summary>

+        ///     Draws the targetable planets.

+        /// </summary>

+        private int DrawPlanets()

+        {

+            var count = 0;

+            foreach (var body in FlightGlobals.Bodies)

+            {

+                if (FlightGlobals.ActiveVessel.mainBody.referenceBody != body.referenceBody || body == Planetarium.fetch.Sun || body == FlightGlobals.ActiveVessel.mainBody)

+                {

+                    continue;

+                }

+

+                if (this.searchQuery.Length > 0 && !body.bodyName.ToLower().Contains(this.searchQuery))

+                {

+                    continue;

+                }

+

+                count++;

+                if (GUILayout.Button(body.GetName(), this.buttonStyle))

+                {

+                    this.SetTargetAs(body);

+                }

+            }

+            return count;

+        }

+

+        /// <summary>

+        ///     Draws targetable vessels.

+        /// </summary>

+        private int DrawVessels()

+        {

+            var count = 0;

+            foreach (var vessel in FlightGlobals.Vessels)

+            {

+                if (vessel == FlightGlobals.ActiveVessel || vessel.vesselType != this.vesselType)

+                {

+                    continue;

+                }

+

+                if (this.searchQuery.Length == 0)

+                {

+                    count++;

+

+                    if (GUILayout.Button(vessel.GetName(), this.buttonStyle))

+                    {

+                        this.SetTargetAs(vessel);

+                    }

+                }

+                else if (vessel.vesselName.ToLower().Contains(this.searchQuery))

+                {

+                    count++;

+                    if (GUILayout.Button(vessel.GetName(), this.buttonStyle))

+                    {

+                        this.SetTargetAs(vessel);

+                    }

+                }

+            }

+            return count;

+        }

+

+        private void SetTypeAs(VesselType vesselType)

+        {

+            this.vesselType = vesselType;

+            SectionList.Instance.RequestResize();

+        }

+

+        private void SetTypeAsBody()

+        {

+            this.typeIsBody = true;

+            SectionList.Instance.RequestResize();

+        }

+

+        private void SetTargetAs(ITargetable target)

+        {

+            FlightGlobals.fetch.SetVesselTarget(target);

+            SectionList.Instance.RequestResize();

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Section.cs
+++ b/KerbalEngineer/FlightEngineer/Section.cs
@@ -1,259 +1,308 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.Collections.Generic;
-using System.IO;
-using KerbalEngineer.Settings;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class Section
-    {
-        #region Properties
-
-        protected GUIStyle TitleStyle { get; private set; }
-        protected GUIStyle AreaStyle { get; private set; }
-        protected GUIStyle LabelStyle { get; private set; }
-
-        private List<Readout> _readouts = new List<Readout>();
-        /// <summary>
-        /// Gets and sets the readouts to be displayed.
-        /// </summary>
-        public List<Readout> Readouts
-        {
-            get { return _readouts; }
-            set { _readouts = value; }
-        }
-
-        private bool _visible = false;
-        /// <summary>
-        /// Gets and sets whether the section is visible.
-        /// </summary>
-        public bool Visible
-        {
-            get { return _visible; }
-            set
-            {
-                if (_visible != value)
-                    FlightDisplay.Instance.RequireResize = true;
-
-                _visible = value;
-            }
-        }
-
-        private string _title = string.Empty;
-        /// <summary>
-        /// Gets and sets the section title.
-        /// </summary>
-        public string Title
-        {
-            get { return _title; }
-            set { _title = value; }
-        }
-
-        private string _shortTitle = string.Empty;
-        /// <summary>
-        /// Gets and sets the section short title.
-        /// </summary>
-        public string ShortTitle
-        {
-            get { return _shortTitle; }
-            set { _shortTitle = value; }
-        }
-
-        private string _fileName = string.Empty;
-        /// <summary>
-        /// Gets and sets the filename of the section.
-        /// </summary>
-        public string FileName
-        {
-            get { return _fileName; }
-            set { _fileName = value; }
-        }
-
-        private bool _isUser = false;
-        /// <summary>
-        /// Gets and sets whether the section was user created.
-        /// </summary>
-        public bool IsUser
-        {
-            get { return _isUser; }
-            set { _isUser = value; }
-        }
-
-        private EditDisplay _editDisplay;
-        /// <summary>
-        /// Gets the edit display associated with the section.
-        /// </summary>
-        public EditDisplay EditDisplay
-        {
-            get { return _editDisplay; }
-        }
-
-        private SectionWindow _window;
-        public SectionWindow Window
-        {
-            get { return _window; }
-        }
-
-        private List<ReadoutCategory> _categories = new List<ReadoutCategory>();
-        /// <summary>
-        /// Gets and sets the categories associated with the section.
-        /// </summary>
-        public List<ReadoutCategory> Categories
-        {
-            get { return _categories; }
-            set { _categories = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        public Section(bool isUserSection = false, bool isNewSection = true)
-        {
-            _editDisplay = HighLogic.fetch.gameObject.AddComponent<EditDisplay>();
-            _editDisplay.Section = this;
-            RenderingManager.AddToPostDrawQueue(0, _editDisplay.Draw);
-
-            _window = HighLogic.fetch.gameObject.AddComponent<SectionWindow>();
-            _window.Section = this;
-            RenderingManager.AddToPostDrawQueue(0, _window.Draw);
-
-            if (isUserSection)
-            {
-                _isUser = true;
-
-                Title = "Custom " + (SectionList.Instance.UserSections.Count + 1);
-                Categories.Add(ReadoutCategory.Orbital);
-                Categories.Add(ReadoutCategory.Surface);
-                Categories.Add(ReadoutCategory.Vessel);
-                Categories.Add(ReadoutCategory.Rendezvous);
-                Categories.Add(ReadoutCategory.Misc);
-                Visible = true;
-
-                if (isNewSection)
-                    _editDisplay.Visible = true;
-            }
-
-            InitialiseStyles();
-        }
-
-        private void InitialiseStyles()
-        {
-            TitleStyle = new GUIStyle(HighLogic.Skin.label);
-            TitleStyle.margin = new RectOffset();
-            TitleStyle.padding = new RectOffset(3, 3, 3, 3);
-            TitleStyle.normal.textColor = Color.white;
-            TitleStyle.fontSize = 13;
-            TitleStyle.fontStyle = FontStyle.Bold;
-            TitleStyle.stretchWidth = true;
-
-            AreaStyle = new GUIStyle(HighLogic.Skin.box);
-            AreaStyle.margin = new RectOffset();
-            AreaStyle.padding = new RectOffset(5, 5, 5, 5);
-
-            LabelStyle = new GUIStyle(HighLogic.Skin.label);
-            LabelStyle.normal.textColor = Color.white;
-            LabelStyle.margin = new RectOffset();
-            LabelStyle.padding = new RectOffset(3, 3, 3, 3);
-            LabelStyle.alignment = TextAnchor.MiddleCenter;
-            LabelStyle.fontSize = 12;
-            LabelStyle.fontStyle = FontStyle.Bold;
-            LabelStyle.stretchWidth = true;
-        }
-
-        #endregion
-
-        #region Update and Draw
-
-        public void Update()
-        {
-            foreach (Readout readout in _readouts)
-                readout.Update();
-        }
-
-        public void Draw()
-        {
-            GUILayout.Label(_title.ToUpper(), TitleStyle);
-            GUILayout.BeginVertical(AreaStyle);
-            if (_readouts.Count > 0)
-            {
-                foreach (Readout readout in _readouts)
-                    readout.Draw();
-            }
-            else
-            {
-                GUILayout.BeginHorizontal(GUILayout.Width(Readout.NameWidth + Readout.DataWidth));
-                GUILayout.Label("No readouts installed!", LabelStyle);
-                GUILayout.EndHorizontal();
-            }
-            GUILayout.EndVertical();
-        }
-
-        #endregion
-
-        #region Save and Load
-
-        // Saves the settings associated with this section.
-        public void Save()
-        {
-            if (_title != _fileName)
-            {
-                if (File.Exists(EngineerGlobals.AssemblyPath + "Settings/Sections/" + _fileName))
-                    File.Delete(EngineerGlobals.AssemblyPath + "Settings/Sections/" + _fileName);
-            }
-
-            _fileName = _title;
-
-            List<string> readoutNames = new List<string>();
-
-            foreach (Readout readout in _readouts)
-                readoutNames.Add(readout.Name);
-
-            try
-            {
-                SettingList list = new SettingList();
-                list.AddSetting("visible", _visible);
-                list.AddSetting("windowed", _window.Visible);
-                list.AddSetting("x", _window.PosX);
-                list.AddSetting("y", _window.PosY);
-                list.AddSetting("categories", _categories);
-                list.AddSetting("readouts", readoutNames);
-                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/Sections/" + _fileName, list);
-
-                MonoBehaviour.print("[KerbalEngineer/FlightSection/" + _title + "]: Successfully saved settings.");
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightSection/" + _title + "]: Failed to save settings."); }
-        }
-
-        // Loads the settings associated with this section.
-        public void Load()
-        {
-            _fileName = _title;
-
-            try
-            {
-                SettingList list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/Sections/" + _fileName);
-                _visible = (bool)list.GetSetting("visible", _visible);
-                _window.Visible = (bool)list.GetSetting("windowed", _window.Visible);
-                _window.PosX = (float)list.GetSetting("x", _window.PosX);
-                _window.PosY = (float)list.GetSetting("y", _window.PosY);
-                _categories = list.GetSetting("categories", _categories) as List<ReadoutCategory>;
-
-                _readouts.Clear();
-                List<string> readoutNames = list.GetSetting("readouts", new List<string>()) as List<string>;
-                foreach (string name in readoutNames)
-                    Readouts.Add(ReadoutList.Instance.GetReadout(name));
-
-                MonoBehaviour.print("[KerbalEngineer/FlightSection/" + _title + "]: Successfully loaded settings.");
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightSection/" + _title + "]: Failed to load settings."); }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.Collections.Generic;

+using System.IO;

+using System.Linq;

+

+using KerbalEngineer.Settings;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class Section

+    {

+        #region Properties

+

+        private readonly EditDisplay editDisplay;

+        private readonly SectionWindow window;

+

+        private List<ReadoutCategory> categories = new List<ReadoutCategory>();

+        private string fileName = string.Empty;

+        private List<Readout> readouts = new List<Readout>();

+        private string shortTitle = string.Empty;

+        private string title = string.Empty;

+        private bool visible;

+

+        /// <summary>

+        ///     Gets the GUIStyle for the section title.

+        /// </summary>

+        protected GUIStyle TitleStyle { get; private set; }

+

+        /// <summary>

+        ///     Gets the GUIStyle for the section area.

+        /// </summary>

+        protected GUIStyle AreaStyle { get; private set; }

+

+        /// <summary>

+        ///     Gets the GUIStyle for section message labels.

+        /// </summary>

+        protected GUIStyle LabelStyle { get; private set; }

+

+        /// <summary>

+        ///     Gets and sets the readouts to be displayed.

+        /// </summary>

+        public List<Readout> Readouts

+        {

+            get { return this.readouts; }

+            set { this.readouts = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether the section is visible.

+        /// </summary>

+        public bool Visible

+        {

+            get { return this.visible; }

+            set

+            {

+                if (this.visible != value)

+                {

+                    FlightDisplay.Instance.RequireResize = true;

+                }

+

+                this.visible = value;

+            }

+        }

+

+        /// <summary>

+        ///     Gets and sets the section title.

+        /// </summary>

+        public string Title

+        {

+            get { return this.title; }

+            set { this.title = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the section short title.

+        /// </summary>

+        public string ShortTitle

+        {

+            get { return this.shortTitle; }

+            set { this.shortTitle = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the filename of the section.

+        /// </summary>

+        public string FileName

+        {

+            get { return this.fileName; }

+            set { this.fileName = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether the section was user created.

+        /// </summary>

+        public bool IsUser { get; set; }

+

+        /// <summary>

+        ///     Gets the edit display associated with the section.

+        /// </summary>

+        public EditDisplay EditDisplay

+        {

+            get { return this.editDisplay; }

+        }

+

+        /// <summary>

+        ///     Gets the section window object.

+        /// </summary>

+        public SectionWindow Window

+        {

+            get { return this.window; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the categories associated with the section.

+        /// </summary>

+        public List<ReadoutCategory> Categories

+        {

+            get { return this.categories; }

+            set { this.categories = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        public Section(bool isUserSection = false, bool isNewSection = true)

+        {

+            this.IsUser = false;

+            this.editDisplay = HighLogic.fetch.gameObject.AddComponent<EditDisplay>();

+            this.editDisplay.Section = this;

+            RenderingManager.AddToPostDrawQueue(0, this.editDisplay.Draw);

+

+            this.window = HighLogic.fetch.gameObject.AddComponent<SectionWindow>();

+            this.window.Section = this;

+            RenderingManager.AddToPostDrawQueue(0, this.window.Draw);

+

+            if (isUserSection)

+            {

+                this.IsUser = true;

+

+                this.Title = "Custom " + (SectionList.Instance.UserSections.Count + 1);

+                this.Categories.Add(ReadoutCategory.Orbital);

+                this.Categories.Add(ReadoutCategory.Surface);

+                this.Categories.Add(ReadoutCategory.Vessel);

+                this.Categories.Add(ReadoutCategory.Rendezvous);

+                this.Categories.Add(ReadoutCategory.Misc);

+                this.Visible = true;

+

+                if (isNewSection)

+                {

+                    this.editDisplay.Visible = true;

+                }

+            }

+

+            this.InitialiseStyles();

+        }

+

+        private void InitialiseStyles()

+        {

+            this.TitleStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset(3, 3, 3, 3),

+                normal =

+                {

+                    textColor = Color.white

+                },

+                fontSize = 13,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+

+            this.AreaStyle = new GUIStyle(HighLogic.Skin.box)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset(5, 5, 5, 5)

+            };

+

+            this.LabelStyle = new GUIStyle(HighLogic.Skin.label)

+            {

+                normal =

+                {

+                    textColor = Color.white

+                },

+                margin = new RectOffset(),

+                padding = new RectOffset(3, 3, 3, 3),

+                alignment = TextAnchor.MiddleCenter,

+                fontSize = 12,

+                fontStyle = FontStyle.Bold,

+                stretchWidth = true

+            };

+        }

+

+        #endregion

+

+        #region Update and Draw

+

+        public void Update()

+        {

+            foreach (var readout in this.readouts)

+            {

+                readout.Update();

+            }

+        }

+

+        public void Draw()

+        {

+            GUILayout.Label(this.title.ToUpper(), this.TitleStyle);

+            GUILayout.BeginVertical(this.AreaStyle);

+            if (this.readouts.Count > 0)

+            {

+                foreach (var readout in this.readouts)

+                {

+                    readout.Draw();

+                }

+            }

+            else

+            {

+                GUILayout.BeginHorizontal(GUILayout.Width(Readout.NameWidth + Readout.DataWidth));

+                GUILayout.Label("No readouts installed!", this.LabelStyle);

+                GUILayout.EndHorizontal();

+            }

+            GUILayout.EndVertical();

+        }

+

+        #endregion

+

+        #region Save and Load

+

+        /// <summary>

+        ///     Saves the settings associated with this section.

+        /// </summary>

+        public void Save()

+        {

+            if (this.title != this.fileName)

+            {

+                if (File.Exists(EngineerGlobals.AssemblyPath + "Settings/Sections/" + this.fileName))

+                {

+                    File.Delete(EngineerGlobals.AssemblyPath + "Settings/Sections/" + this.fileName);

+                }

+            }

+

+            this.fileName = this.title;

+

+            var readoutNames = this.readouts.Select(readout => readout.Name).ToList();

+

+            try

+            {

+                var list = new SettingList();

+                list.AddSetting("visible", this.visible);

+                list.AddSetting("windowed", this.window.Visible);

+                list.AddSetting("x", this.window.PosX);

+                list.AddSetting("y", this.window.PosY);

+                list.AddSetting("categories", this.categories);

+                list.AddSetting("readouts", readoutNames);

+                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/Sections/" + this.fileName, list);

+

+                MonoBehaviour.print("[KerbalEngineer/FlightSection/" + this.title + "]: Successfully saved settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightSection/" + this.title + "]: Failed to save settings.");

+            }

+        }

+

+        /// <summary>

+        ///     Loads the settings associated with this section.

+        /// </summary>

+        public void Load()

+        {

+            this.fileName = this.title;

+

+            try

+            {

+                var list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/Sections/" + this.fileName);

+                this.visible = (bool)list.GetSetting("visible", this.visible);

+                this.window.Visible = (bool)list.GetSetting("windowed", this.window.Visible);

+                this.window.PosX = (float)list.GetSetting("x", this.window.PosX);

+                this.window.PosY = (float)list.GetSetting("y", this.window.PosY);

+                this.categories = list.GetSetting("categories", this.categories) as List<ReadoutCategory>;

+

+                this.readouts.Clear();

+                var readoutNames = list.GetSetting("readouts", new List<string>()) as List<string>;

+                foreach (var name in readoutNames)

+                {

+                    this.Readouts.Add(ReadoutList.Instance.GetReadout(name));

+                }

+

+                MonoBehaviour.print("[KerbalEngineer/FlightSection/" + this.title + "]: Successfully loaded settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightSection/" + this.title + "]: Failed to load settings.");

+            }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/SectionList.cs
+++ b/KerbalEngineer/FlightEngineer/SectionList.cs
@@ -1,276 +1,356 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System.Collections.Generic;
-using KerbalEngineer.Settings;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class SectionList
-    {
-        #region Static Fields
-
-        private static bool _hasLoadedSections = false;
-
-        #endregion
-
-        #region Instance
-
-        private static SectionList _instance;
-        /// <summary>
-        /// Gets the current instance of the section list.
-        /// </summary>
-        public static SectionList Instance
-        {
-            get
-            {
-                if (_instance == null)
-                    _instance = new SectionList();
-
-                return _instance;
-            }
-        }
-
-        #endregion
-
-        #region Properties
-
-        private List<Section> _fixedSections = new List<Section>();
-        /// <summary>
-        /// Gets and sets the available fixed sections.
-        /// </summary>
-        public List<Section> FixedSections
-        {
-            get { return _fixedSections; }
-            set { _fixedSections = value; }
-        }
-
-        private List<Section> _userSections = new List<Section>();
-        /// <summary>
-        /// Gets and sets the available user sections.
-        /// </summary>
-        public List<Section> UserSections
-        {
-            get { return _userSections; }
-            set { _userSections = value; }
-        }
-
-        private bool _requireResize = false;
-        /// <summary>
-        /// Gets and sets whether to resize all displays.
-        /// </summary>
-        public bool RequireResize
-        {
-            get { return _requireResize; }
-            set { _requireResize = value; }
-        }
-
-        private bool _hasVisibleSections = false;
-        /// <summary>
-        /// Gets whether there are visible sections.
-        /// </summary>
-        public bool HasVisibleSections
-        {
-            get { return _hasVisibleSections; }
-        }
-
-        private bool _hasAttachedSections = false;
-        /// <summary>
-        /// Gets whether there are attached sections.
-        /// </summary>
-        public bool HasAttachedSections
-        {
-            get { return _hasAttachedSections; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        private SectionList()
-        {
-            _fixedSections.Add(new Section() { Title = "Orbital", Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Orbital), Categories = new List<ReadoutCategory> { ReadoutCategory.Orbital }, ShortTitle = "ORBT" });
-            _fixedSections.Add(new Section() { Title = "Surface", Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Surface), Categories = new List<ReadoutCategory> { ReadoutCategory.Surface }, ShortTitle = "SURF" });
-            _fixedSections.Add(new Section() { Title = "Vessel", Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Vessel), Categories = new List<ReadoutCategory> { ReadoutCategory.Vessel }, ShortTitle = "VESL" });
-            _fixedSections.Add(new Section() { Title = "Rendezvous", Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Rendezvous), Categories = new List<ReadoutCategory> { ReadoutCategory.Rendezvous }, ShortTitle = "RDZV" });
-        }
-
-        #endregion
-
-        #region Public Methods
-
-        /// <summary>
-        /// Gets the fixed section with the provided name.
-        /// </summary>
-        public Section GetFixedSection(string name)
-        {
-            foreach (Section section in _fixedSections)
-                if (section.Title == name)
-                    return section;
-
-            return null;
-        }
-
-        /// <summary>
-        /// Gets the user section with the provided name.
-        /// </summary>
-        public Section GetUserSection(string name)
-        {
-            foreach (Section section in _userSections)
-                if (section.Title == name)
-                    return section;
-
-            return null;
-        }
-
-        #endregion
-
-        #region Update
-
-        public void Update()
-        {
-            if (_hasLoadedSections) _hasLoadedSections = false;
-
-            // If a resize is required propagate it to the handling objects.
-            if (_requireResize)
-            {
-                _requireResize = false;
-                FlightDisplay.Instance.RequireResize = true;
-
-                foreach (Section section in _fixedSections)
-                    section.Window.RequireResize = true;
-
-                foreach (Section section in _userSections)
-                    section.Window.RequireResize = true;
-            }
-
-            _hasVisibleSections = false;
-            _hasAttachedSections = false;
-
-            // Update all visible fixed sections.
-            foreach (Section section in _fixedSections)
-            {
-                if (section.Visible)
-                {
-                    if (!_hasVisibleSections) _hasVisibleSections = true;
-                    if (!section.Window.Visible && !_hasAttachedSections) _hasAttachedSections = true;
-                    section.Update();
-                }
-            }
-
-            // Update all visible user sections.
-            foreach (Section section in _userSections)
-            {
-                if (section.Visible)
-                {
-                    if (!_hasVisibleSections) _hasVisibleSections = true;
-                    if (!section.Window.Visible && !_hasAttachedSections) _hasAttachedSections = true;
-                    section.Update();
-                }
-            }
-
-            Surface.AtmosphericDetails.Instance.Update();
-            SimulationManager.Instance.Gravity = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ActiveVessel.GetWorldPos3D()).magnitude;
-            SimulationManager.Instance.Atmosphere = FlightGlobals.getAtmDensity(FlightGlobals.ActiveVessel.staticPressure);
-            SimulationManager.Instance.TryStartSimulation();
-        }
-
-        #endregion
-
-        #region Save and Load
-
-        // Saves the settings associated with the section list.
-        public void Save()
-        {
-            List<string> fixedSectionNames = new List<string>();
-            List<string> userSectionNames = new List<string>();
-
-            foreach (Section section in _fixedSections)
-            {
-                fixedSectionNames.Add(section.Title);
-                section.Save();
-            }
-
-            foreach (Section section in _userSections)
-            {
-                userSectionNames.Add(section.Title);
-                section.Save();
-            }
-
-            try
-            {
-                SettingList list = new SettingList();
-                list.AddSetting("fixed_sections", fixedSectionNames);
-                list.AddSetting("user_sections", userSectionNames);
-                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/FlightSections", list);
-
-                MonoBehaviour.print("[KerbalEngineer/FlightSections]: Successfully saved settings.");
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightSections]: Failed to save settings."); }
-        }
-
-        // Loads the settings associated with the section list.
-        public void Load()
-        {
-            try
-            {
-                if (!_hasLoadedSections)
-                {
-                    _hasLoadedSections = true;
-
-                    SettingList list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/FlightSections");
-
-                    List<string> fixedSectionNames = list.GetSetting("fixed_sections", new List<string>()) as List<string>;
-                    List<string> userSectionNames = list.GetSetting("user_sections", new List<string>()) as List<string>;
-
-                    // Load fixed sections.
-                    foreach (string name in fixedSectionNames)
-                    {
-                        Section section = GetFixedSection(name);
-
-                        if (section == null)
-                        {
-                            section = new Section(true, false) { Title = name };
-                            _fixedSections.Add(section);
-                        }
-                        else
-                        {
-                            RenderingManager.AddToPostDrawQueue(0, section.Window.Draw);
-                            RenderingManager.AddToPostDrawQueue(0, section.EditDisplay.Draw);
-                        }
-
-                        section.Load();
-                    }
-
-                    // Load user sections.
-                    foreach (string name in userSectionNames)
-                    {
-                        Section section = GetUserSection(name);
-
-                        if (section == null)
-                        {
-                            section = new Section(true, false) { Title = name };
-                            _userSections.Add(section);
-                        }
-                        else
-                        {
-                            RenderingManager.AddToPostDrawQueue(0, section.Window.Draw);
-                            RenderingManager.AddToPostDrawQueue(0, section.EditDisplay.Draw);
-                        }
-
-                        section.Load();
-                    }
-
-                    MonoBehaviour.print("[KerbalEngineer/FlightSections]: Successfully loaded settings.");
-                }  
-            }
-            catch { MonoBehaviour.print("[KerbalEngineer/FlightSections]: Failed to load settings."); }
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System.Collections.Generic;

+using System.Linq;

+

+using KerbalEngineer.FlightEngineer.Surface;

+using KerbalEngineer.Settings;

+using KerbalEngineer.Simulation;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class SectionList

+    {

+        #region Static Fields

+

+        private static bool _hasLoadedSections;

+

+        #endregion

+

+        #region Instance

+

+        private static SectionList _instance;

+

+        /// <summary>

+        ///     Gets the current instance of the section list.

+        /// </summary>

+        public static SectionList Instance

+        {

+            get { return _instance ?? (_instance = new SectionList()); }

+        }

+

+        #endregion

+

+        #region Properties

+

+        private List<Section> fixedSections = new List<Section>();

+        private bool hasAttachedSections;

+        private bool hasVisibleSections;

+        private bool requireResize;

+

+        private List<Section> userSections = new List<Section>();

+

+        /// <summary>

+        ///     Gets and sets the available fixed sections.

+        /// </summary>

+        public List<Section> FixedSections

+        {

+            get { return this.fixedSections; }

+            set { this.fixedSections = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the available user sections.

+        /// </summary>

+        public List<Section> UserSections

+        {

+            get { return this.userSections; }

+            set { this.userSections = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether to resize all displays.

+        /// </summary>

+        public bool ResizeRequested

+        {

+            get { return this.requireResize; }

+        }

+

+        /// <summary>

+        ///     Gets whether there are visible sections.

+        /// </summary>

+        public bool HasVisibleSections

+        {

+            get { return this.hasVisibleSections; }

+        }

+

+        /// <summary>

+        ///     Gets whether there are attached sections.

+        /// </summary>

+        public bool HasAttachedSections

+        {

+            get { return this.hasAttachedSections; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        private SectionList()

+        {

+            this.fixedSections.Add(new Section

+            {

+                Title = "Orbital",

+                Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Orbital),

+                Categories = new List<ReadoutCategory>

+                {

+                    ReadoutCategory.Orbital

+                },

+                ShortTitle = "ORBT"

+            });

+

+            this.fixedSections.Add(new Section

+            {

+                Title = "Surface",

+                Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Surface),

+                Categories = new List<ReadoutCategory>

+                {

+                    ReadoutCategory.Surface

+                },

+                ShortTitle = "SURF"

+            });

+

+            this.fixedSections.Add(new Section

+            {

+                Title = "Vessel",

+                Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Vessel),

+                Categories = new List<ReadoutCategory>

+                {

+                    ReadoutCategory.Vessel

+                },

+                ShortTitle = "VESL"

+            });

+

+            this.fixedSections.Add(new Section

+            {

+                Title = "Rendezvous",

+                Readouts = ReadoutList.Instance.GetCategory(ReadoutCategory.Rendezvous),

+                Categories = new List<ReadoutCategory>

+                {

+                    ReadoutCategory.Rendezvous

+                },

+                ShortTitle = "RDZV"

+            });

+        }

+

+        #endregion

+

+        #region Public Methods

+

+        /// <summary>

+        ///     Gets the fixed section with the provided name.

+        /// </summary>

+        public Section GetFixedSection(string name)

+        {

+            return this.fixedSections.FirstOrDefault(section => section.Title == name);

+        }

+

+        /// <summary>

+        ///     Gets the user section with the provided name.

+        /// </summary>

+        public Section GetUserSection(string name)

+        {

+            return this.userSections.FirstOrDefault(section => section.Title == name);

+        }

+

+        public void RequestResize()

+        {

+            this.requireResize = true;

+        }

+

+        #endregion

+

+        #region Update

+

+        public void Update()

+        {

+            if (_hasLoadedSections)

+            {

+                _hasLoadedSections = false;

+            }

+

+            // If a resize is required propagate it to the handling objects.

+            if (this.requireResize)

+            {

+                this.requireResize = false;

+                FlightDisplay.Instance.RequireResize = true;

+

+                foreach (var section in this.fixedSections)

+                {

+                    section.Window.RequireResize = true;

+                }

+

+                foreach (var section in this.userSections)

+                {

+                    section.Window.RequireResize = true;

+                }

+            }

+

+            this.hasVisibleSections = false;

+            this.hasAttachedSections = false;

+

+            // Update all visible fixed sections.

+            foreach (var section in this.fixedSections)

+            {

+                if (!section.Visible)

+                {

+                    continue;

+                }

+

+                if (!this.hasVisibleSections)

+                {

+                    this.hasVisibleSections = true;

+                }

+                if (!section.Window.Visible && !this.hasAttachedSections)

+                {

+                    this.hasAttachedSections = true;

+                }

+                section.Update();

+            }

+

+            // Update all visible user sections.

+            foreach (var section in this.userSections)

+            {

+                if (!section.Visible)

+                {

+                    continue;

+                }

+

+                if (!this.hasVisibleSections)

+                {

+                    this.hasVisibleSections = true;

+                }

+                if (!section.Window.Visible && !this.hasAttachedSections)

+                {

+                    this.hasAttachedSections = true;

+                }

+                section.Update();

+            }

+

+            AtmosphericDetails.Instance.Update();

+            SimulationManager.Instance.Gravity = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ActiveVessel.GetWorldPos3D()).magnitude;

+            SimulationManager.Instance.Atmosphere = FlightGlobals.getAtmDensity(FlightGlobals.ActiveVessel.staticPressure);

+            SimulationManager.Instance.TryStartSimulation();

+        }

+

+        #endregion

+

+        #region Save and Load

+

+        /// <summary>

+        ///     Saves the settings associated with the section list.

+        /// </summary>

+        public void Save()

+        {

+            var fixedSectionNames = new List<string>();

+            var userSectionNames = new List<string>();

+

+            foreach (var section in this.fixedSections)

+            {

+                fixedSectionNames.Add(section.Title);

+                section.Save();

+            }

+

+            foreach (var section in this.userSections)

+            {

+                userSectionNames.Add(section.Title);

+                section.Save();

+            }

+

+            try

+            {

+                var list = new SettingList();

+                list.AddSetting("fixed_sections", fixedSectionNames);

+                list.AddSetting("user_sections", userSectionNames);

+                SettingList.SaveToFile(EngineerGlobals.AssemblyPath + "Settings/FlightSections", list);

+

+                MonoBehaviour.print("[KerbalEngineer/FlightSections]: Successfully saved settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightSections]: Failed to save settings.");

+            }

+        }

+

+        /// <summary>

+        ///     Loads the settings associated with the section list.

+        /// </summary>

+        public void Load()

+        {

+            try

+            {

+                if (_hasLoadedSections)

+                {

+                    return;

+                }

+

+                _hasLoadedSections = true;

+

+                var list = SettingList.CreateFromFile(EngineerGlobals.AssemblyPath + "Settings/FlightSections");

+

+                var fixedSectionNames = list.GetSetting("fixed_sections", new List<string>()) as List<string>;

+                var userSectionNames = list.GetSetting("user_sections", new List<string>()) as List<string>;

+

+                // Load fixed sections.

+                foreach (var name in fixedSectionNames)

+                {

+                    var section = this.GetFixedSection(name);

+

+                    if (section == null)

+                    {

+                        section = new Section(true, false)

+                        {

+                            Title = name

+                        };

+                        this.fixedSections.Add(section);

+                    }

+                    else

+                    {

+                        RenderingManager.AddToPostDrawQueue(0, section.Window.Draw);

+                        RenderingManager.AddToPostDrawQueue(0, section.EditDisplay.Draw);

+                    }

+

+                    section.Load();

+                }

+

+                // Load user sections.

+                foreach (var name in userSectionNames)

+                {

+                    var section = this.GetUserSection(name);

+

+                    if (section == null)

+                    {

+                        section = new Section(true, false)

+                        {

+                            Title = name

+                        };

+                        this.userSections.Add(section);

+                    }

+                    else

+                    {

+                        RenderingManager.AddToPostDrawQueue(0, section.Window.Draw);

+                        RenderingManager.AddToPostDrawQueue(0, section.EditDisplay.Draw);

+                    }

+

+                    section.Load();

+                }

+

+                MonoBehaviour.print("[KerbalEngineer/FlightSections]: Successfully loaded settings.");

+            }

+            catch

+            {

+                MonoBehaviour.print("[KerbalEngineer/FlightSections]: Failed to load settings.");

+            }

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/SectionWindow.cs
+++ b/KerbalEngineer/FlightEngineer/SectionWindow.cs
@@ -1,121 +1,127 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer
-{
-    public class SectionWindow : MonoBehaviour
-    {
-        #region Fields
-
-        private Rect _position = new Rect(Screen.width / 2f - 125f, 100f, 250f, 0f);
-        private GUIStyle _windowStyle;
-        private int _windowID = EngineerGlobals.GetNextWindowID();
-
-        private bool _hasInitStyles = false;
-
-        #endregion
-
-        #region Properties
-
-        /// <summary>
-        /// Gets and sets the X position of the window.
-        /// </summary>
-        public float PosX
-        {
-            get { return _position.x; }
-            set { _position.x = value; }
-        }
-
-        /// <summary>
-        /// Gets and sets the Y position of the window.
-        /// </summary>
-        public float PosY
-        {
-            get { return _position.y; }
-            set { _position.y = value; }
-        }
-
-        private bool _visible = false;
-        /// <summary>
-        /// Gets and sets the visibility of the window.
-        /// </summary>
-        public bool Visible
-        {
-            get { return _visible; }
-            set { _visible = value; }
-        }
-
-        private Section _section;
-        /// <summary>
-        /// Gets and sets the parent section.
-        /// </summary>
-        public Section Section
-        {
-            get { return _section; }
-            set { _section = value; }
-        }
-
-        private bool _requireResize = false;
-        /// <summary>
-        /// Gets and sets whether the window requires a resize.
-        /// </summary>
-        public bool RequireResize
-        {
-            get { return _requireResize; }
-            set { _requireResize = value; }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        private void InitialiseStyles()
-        {
-            _hasInitStyles = true;
-
-            _windowStyle = new GUIStyle(HighLogic.Skin.window);
-            _windowStyle.margin = new RectOffset();
-            _windowStyle.padding = new RectOffset(5, 5, 3, 5);
-            _windowStyle.fixedWidth = 270f;
-        }
-
-        #endregion
-
-        #region Update and Drawing
-
-        private void Update()
-        {
-        }
-
-        public void Draw()
-        {
-            if (_section.Visible && _visible)
-            {
-                if (!_hasInitStyles) InitialiseStyles();
-
-                // Handle window resizing if something has changed within the GUI.
-                if (_requireResize)
-                {
-                    _requireResize = false;
-                    _position.width = 0f;
-                    _position.height = 0f;
-                }
-
-                _position = GUILayout.Window(_windowID, _position, Window, string.Empty, _windowStyle).ClampToScreen();
-            }
-        }
-
-        private void Window(int windowID)
-        {
-            _section.Draw();
-            GUI.DragWindow();
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+using UnityEngine;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer

+{

+    public class SectionWindow : MonoBehaviour

+    {

+        #region Fields

+

+        private readonly int windowId = EngineerGlobals.GetNextWindowId();

+        private Rect position = new Rect(Screen.width * 0.5f - 125.0f, 100.0f, 250.0f, 0);

+        private GUIStyle windowStyle;

+

+        #endregion

+

+        #region Properties

+

+        private bool requireResize;

+        private Section section;

+        private bool visible;

+

+        /// <summary>

+        ///     Gets and sets the X position of the window.

+        /// </summary>

+        public float PosX

+        {

+            get { return this.position.x; }

+            set { this.position.x = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the Y position of the window.

+        /// </summary>

+        public float PosY

+        {

+            get { return this.position.y; }

+            set { this.position.y = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the visibility of the window.

+        /// </summary>

+        public bool Visible

+        {

+            get { return this.visible; }

+            set { this.visible = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets the parent section.

+        /// </summary>

+        public Section Section

+        {

+            get { return this.section; }

+            set { this.section = value; }

+        }

+

+        /// <summary>

+        ///     Gets and sets whether the window requires a resize.

+        /// </summary>

+        public bool RequireResize

+        {

+            get { return this.requireResize; }

+            set { this.requireResize = value; }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        private void Start()

+        {

+            this.InitialiseStyles();

+        }

+

+        private void InitialiseStyles()

+        {

+            this.windowStyle = new GUIStyle(HighLogic.Skin.window)

+            {

+                margin = new RectOffset(),

+                padding = new RectOffset(5, 5, 3, 5),

+                fixedWidth = 270.0f

+            };

+        }

+

+        #endregion

+

+        #region Update and Drawing

+

+        private void Update() { }

+

+        public void Draw()

+        {

+            if (!this.section.Visible || !this.visible)

+            {

+                return;

+            }

+

+            // Handle window resizing if something has changed within the GUI.

+            if (this.requireResize)

+            {

+                this.requireResize = false;

+                this.position.width = 0;

+                this.position.height = 0;

+            }

+

+            this.position = GUILayout.Window(this.windowId, this.position, this.Window, string.Empty, this.windowStyle).ClampToScreen();

+        }

+

+        private void Window(int windowId)

+        {

+            this.section.Draw();

+            GUI.DragWindow();

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/AltitudeSeaLevel.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/AltitudeSeaLevel.cs
@@ -1,26 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class AltitudeSeaLevel : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Altitude (Sea Level)";
-            Description = "Shows your altitude relative to sea level.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.altitude.ToDistance());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class AltitudeSeaLevel : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Altitude (Sea Level)";

+            this.Description = "Shows your altitude relative to sea level.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.altitude.ToDistance());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/AltitudeTerrain.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/AltitudeTerrain.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class AltitudeTerrain : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Altitude (Terrain)";
-            Description = "Shows your altitude above the terrain.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Draw()
-        {
-            DrawLine((FlightGlobals.ActiveVessel.altitude - FlightGlobals.ActiveVessel.terrainAltitude).ToDistance());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class AltitudeTerrain : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Altitude (Terrain)";

+            this.Description = "Shows your altitude above the terrain.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine((FlightGlobals.ActiveVessel.altitude - FlightGlobals.ActiveVessel.terrainAltitude).ToDistance());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/AtmosEfficiency.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/AtmosEfficiency.cs
@@ -1,47 +1,47 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using System.Linq;
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class AtmosEfficiency : Readout
-    {
-        private bool _visible = false;
-
-        protected override void Initialise()
-        {
-            Name = "Atmos. Efficiency";
-            Description = "The difference between current and terminal velocity.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Update()
-        {
-            if (FlightGlobals.ActiveVessel.atmDensity > 0d)
-                AtmosphericDetails.Instance.RequestUpdate = true;
-        }
-
-        public override void Draw()
-        {
-            if (FlightGlobals.ActiveVessel.atmDensity > 0d)
-            {
-                if (!_visible) _visible = true;
-                DrawLine(AtmosphericDetails.Instance.Efficiency.ToString("0.00"));
-            }
-            else
-            {
-                if (_visible)
-                {
-                    _visible = false;
-                    SectionList.Instance.RequireResize = true;
-                }
-            }
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class AtmosEfficiency : Readout

+    {

+        private bool visible;

+

+        protected override void Initialise()

+        {

+            this.Name = "Atmos. Efficiency";

+            this.Description = "The difference between current and terminal velocity.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Update()

+        {

+            if (FlightGlobals.ActiveVessel.atmDensity > 0)

+            {

+                AtmosphericDetails.Instance.RequestUpdate();

+            }

+        }

+

+        public override void Draw()

+        {

+            if (FlightGlobals.ActiveVessel.atmDensity > 0)

+            {

+                if (!this.visible)

+                {

+                    this.visible = true;

+                }

+

+                this.DrawLine(AtmosphericDetails.Instance.Efficiency.ToString("0.00"));

+            }

+            else

+            {

+                if (this.visible)

+                {

+                    this.visible = false;

+                    SectionList.Instance.RequestResize();

+                }

+            }

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/AtmosphericDetails.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/AtmosphericDetails.cs
@@ -1,84 +1,99 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using System.Linq;
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class AtmosphericDetails
-    {
-        #region Instance
-
-        private static AtmosphericDetails _instance;
-        /// <summary>
-        /// Gets the current instance of atmospheric details.
-        /// </summary>
-        public static AtmosphericDetails Instance
-        {
-            get
-            {
-                if (_instance == null)
-                    _instance = new AtmosphericDetails();
-
-                return _instance;
-            }
-        }
-
-        #endregion
-
-        #region Properties
-
-        private bool _requestUpdate = false;
-        /// <summary>
-        /// Gets and sets whether an update has been requested.
-        /// </summary>
-        public bool RequestUpdate
-        {
-            get { return _requestUpdate; }
-            set { _requestUpdate = value; }
-        }
-
-        private double _terminalVelocity = 0d;
-        /// <summary>
-        /// Gets the terminal velocity of the active vessel.
-        /// </summary>
-        public double TerminalVelocity
-        {
-            get { return _terminalVelocity; }
-        }
-
-        private double _efficiency = 0d;
-        /// <summary>
-        /// Gets the difference between current velocity and terminal velocity.
-        /// </summary>
-        public double Efficiency
-        {
-            get { return _efficiency; }
-        }
-
-        #endregion
-
-        // Updates the details by recalculating if requested.
-        public void Update()
-        {
-            if (_requestUpdate)
-            {
-                _requestUpdate = false;
-
-                double mass = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass());
-                double drag = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass() * p.maximum_drag);
-                double grav = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ActiveVessel.CoM).magnitude;
-                double atmo = FlightGlobals.ActiveVessel.atmDensity;
-                double coef = FlightGlobals.DragMultiplier;
-
-                _terminalVelocity = Math.Sqrt((2 * mass * grav) / (atmo * drag * coef));
-                _efficiency = FlightGlobals.ActiveVessel.srf_velocity.magnitude / _terminalVelocity;
-            }
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using System;

+using System.Linq;

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class AtmosphericDetails

+    {

+        #region Instance

+

+        private static AtmosphericDetails _instance;

+

+        /// <summary>

+        ///     Gets the current instance of atmospheric details.

+        /// </summary>

+        public static AtmosphericDetails Instance

+        {

+            get { return _instance ?? (_instance = new AtmosphericDetails()); }

+        }

+

+        #endregion

+

+        #region Fields

+

+        private bool updateRequested;

+

+        #endregion

+

+        #region Properties

+

+        private double efficiency;

+        private double terminalVelocity;

+

+        /// <summary>

+        ///     Gets whether an update has been requested.

+        /// </summary>

+        public bool UpdateRequested

+        {

+            get { return this.updateRequested; }

+        }

+

+        /// <summary>

+        ///     Gets the terminal velocity of the active vessel.

+        /// </summary>

+        public double TerminalVelocity

+        {

+            get { return this.terminalVelocity; }

+        }

+

+        /// <summary>

+        ///     Gets the difference between current velocity and terminal velocity.

+        /// </summary>

+        public double Efficiency

+        {

+            get { return this.efficiency; }

+        }

+

+        #endregion

+

+        /// <summary>

+        /// Updated the details by recalculating if requested.

+        /// </summary>

+        public void Update()

+        {

+            if (!this.updateRequested)

+            {

+                return;

+            }

+

+            this.updateRequested = false;

+

+            var mass = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass());

+            var drag = FlightGlobals.ActiveVessel.parts.Sum(p => p.GetWetMass() * p.maximum_drag);

+            var grav = FlightGlobals.getGeeForceAtPosition(FlightGlobals.ActiveVessel.CoM).magnitude;

+            var atmo = FlightGlobals.ActiveVessel.atmDensity;

+            var coef = FlightGlobals.DragMultiplier;

+

+            this.terminalVelocity = Math.Sqrt((2 * mass * grav) / (atmo * drag * coef));

+            this.efficiency = FlightGlobals.ActiveVessel.srf_velocity.magnitude / this.terminalVelocity;

+        }

+

+        /// <summary>

+        /// Request an update to recalculate the details.

+        /// </summary>

+        public void RequestUpdate()

+        {

+            this.updateRequested = true;

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/Horizontal Speed.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/Horizontal Speed.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class HorizontalSpeed : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Horizontal Speed";
-            Description = "Shows your horizontal speed.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToSpeed());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class HorizontalSpeed : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Horizontal Speed";

+            this.Description = "Shows your horizontal speed.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.horizontalSrfSpeed.ToSpeed());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/Latitude.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/Latitude.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class Latitude : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Latitude";
-            Description = "Shows your angle of latitude.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.latitude.ToAngle());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class Latitude : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Latitude";

+            this.Description = "Shows your angle of latitude.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.latitude.ToAngle());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/Longitude.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/Longitude.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class Longitude : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Longitude";
-            Description = "Shows your angle of longitude.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.longitude.ToAngle());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class Longitude : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Longitude";

+            this.Description = "Shows your angle of longitude.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.longitude.ToAngle());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/TerminalVelocity.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/TerminalVelocity.cs
@@ -1,47 +1,53 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using System.Linq;
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class TerminalVelocity : Readout
-    {
-        private bool _visible = false;
-
-        protected override void Initialise()
-        {
-            Name = "Terminal Velocity";
-            Description = "Shows your terminal velocity in atmosphere.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Update()
-        {
-            if (FlightGlobals.ActiveVessel.atmDensity > 0d)
-                AtmosphericDetails.Instance.RequestUpdate = true;
-        }
-
-        public override void Draw()
-        {
-            if (FlightGlobals.ActiveVessel.atmDensity > 0d)
-            {
-                if (!_visible) _visible = true;
-                DrawLine(AtmosphericDetails.Instance.TerminalVelocity.ToSpeed());
-            }
-            else
-            {
-                if (_visible)
-                {
-                    _visible = false;
-                    SectionList.Instance.RequireResize = true;
-                }
-            }
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class TerminalVelocity : Readout

+    {

+        private bool visible;

+

+        protected override void Initialise()

+        {

+            this.Name = "Terminal Velocity";

+            this.Description = "Shows your terminal velocity in atmosphere.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Update()

+        {

+            if (FlightGlobals.ActiveVessel.atmDensity > 0)

+            {

+                AtmosphericDetails.Instance.RequestUpdate();

+            }

+        }

+

+        public override void Draw()

+        {

+            if (FlightGlobals.ActiveVessel.atmDensity > 0)

+            {

+                if (!this.visible)

+                {

+                    this.visible = true;

+                }

+

+                this.DrawLine(AtmosphericDetails.Instance.TerminalVelocity.ToSpeed());

+            }

+            else

+            {

+                if (this.visible)

+                {

+                    this.visible = false;

+                    SectionList.Instance.RequestResize();

+                }

+            }

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Surface/VerticalSpeed.cs
+++ b/KerbalEngineer/FlightEngineer/Surface/VerticalSpeed.cs
@@ -1,25 +1,27 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Surface
-{
-    public class VerticalSpeed : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Vertical Speed";
-            Description = "Shows your vertical speed.";
-            Category = ReadoutCategory.Surface;
-        }
-
-        public override void Draw()
-        {
-            DrawLine(FlightGlobals.ActiveVessel.verticalSpeed.ToSpeed());
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Surface

+{

+    public class VerticalSpeed : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Vertical Speed";

+            this.Description = "Shows your vertical speed.";

+            this.Category = ReadoutCategory.Surface;

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(FlightGlobals.ActiveVessel.verticalSpeed.ToSpeed());

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Vessel/DeltaVStaged.cs
+++ b/KerbalEngineer/FlightEngineer/Vessel/DeltaVStaged.cs
@@ -1,50 +1,51 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Vessel
-{
-    public class DeltaVStaged : Readout
-    {
-        private int _stageCount = 0;
-
-        protected override void Initialise()
-        {
-            Name = "DeltaV Staged";
-            Description = "Shows the deltaV for each stage.";
-            Category = ReadoutCategory.Vessel;
-        }
-
-        public override void Update()
-        {
-            SimulationManager.Instance.RequestSimulation();
-        }
-
-        public override void Draw()
-        {
-            int stageCount = 0;
-
-            for (int i = SimulationManager.Instance.Stages.Length - 1; i > -1; i--)
-            {
-                Stage stage = SimulationManager.Instance.Stages[i];
-                if (stage.thrust > 0d)
-                {
-                    stageCount++;
-                    DrawLine("DeltaV (" + stage.Number + ")", stage.DeltaV);
-                }
-            }
-
-            if (stageCount < _stageCount)
-                SectionList.Instance.RequireResize = true;
-
-            if (stageCount != _stageCount)
-                _stageCount = stageCount;
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Simulation;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Vessel

+{

+    public class DeltaVStaged : Readout

+    {

+        private int stageCount;

+

+        protected override void Initialise()

+        {

+            this.Name = "DeltaV Staged";

+            this.Description = "Shows the deltaV for each stage.";

+            this.Category = ReadoutCategory.Vessel;

+        }

+

+        public override void Update()

+        {

+            SimulationManager.Instance.RequestSimulation();

+        }

+

+        public override void Draw()

+        {

+            var stageCount = 0;

+

+            for (var i = SimulationManager.Instance.Stages.Length - 1; i > -1; i--)

+            {

+                var stage = SimulationManager.Instance.Stages[i];

+                if (stage.thrust > 0)

+                {

+                    stageCount++;

+                    this.DrawLine("DeltaV (" + stage.Number + ")", stage.DeltaV);

+                }

+            }

+

+            if (stageCount < this.stageCount)

+            {

+                SectionList.Instance.RequestResize();

+            }

+

+            this.stageCount = stageCount;

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Vessel/DeltaVTotal.cs
+++ b/KerbalEngineer/FlightEngineer/Vessel/DeltaVTotal.cs
@@ -1,32 +1,32 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Vessel
-{
-    public class DeltaVTotal : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "DeltaV Total";
-            Description = "Shows the total deltaV for the vessel.";
-            Category = ReadoutCategory.Vessel;
-        }
-
-        public override void Update()
-        {
-            SimulationManager.Instance.RequestSimulation();
-        }
-
-        public override void Draw()
-        {
-            DrawLine(SimulationManager.Instance.LastStage.TotalDeltaV);
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Simulation;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Vessel

+{

+    public class DeltaVTotal : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "DeltaV Total";

+            this.Description = "Shows the total deltaV for the vessel.";

+            this.Category = ReadoutCategory.Vessel;

+        }

+

+        public override void Update()

+        {

+            SimulationManager.Instance.RequestSimulation();

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(SimulationManager.Instance.LastStage.TotalDeltaV);

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Vessel/SpecificImpulse.cs
+++ b/KerbalEngineer/FlightEngineer/Vessel/SpecificImpulse.cs
@@ -1,32 +1,32 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Vessel
-{
-    public class SpecificImpulse : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Specific Impulse";
-            Description = "Shows the specific impulse.";
-            Category = ReadoutCategory.Vessel;
-        }
-
-        public override void Update()
-        {
-            SimulationManager.Instance.RequestSimulation();
-        }
-
-        public override void Draw()
-        {
-            DrawLine(SimulationManager.Instance.LastStage.Isp);
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Simulation;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Vessel

+{

+    public class SpecificImpulse : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Specific Impulse";

+            this.Description = "Shows the specific impulse.";

+            this.Category = ReadoutCategory.Vessel;

+        }

+

+        public override void Update()

+        {

+            SimulationManager.Instance.RequestSimulation();

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(SimulationManager.Instance.LastStage.Isp);

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Vessel/ThrustActual.cs
+++ b/KerbalEngineer/FlightEngineer/Vessel/ThrustActual.cs
@@ -1,32 +1,32 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Vessel
-{
-    public class ThrustActual : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Thrust (Actual)";
-            Description = "Shows the actual vessel thrust.";
-            Category = ReadoutCategory.Vessel;
-        }
-
-        public override void Update()
-        {
-            SimulationManager.Instance.RequestSimulation();
-        }
-
-        public override void Draw()
-        {
-            DrawLine(SimulationManager.Instance.LastStage.ActualThrust);
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Simulation;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Vessel

+{

+    public class ThrustActual : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Thrust (Actual)";

+            this.Description = "Shows the actual vessel thrust.";

+            this.Category = ReadoutCategory.Vessel;

+        }

+

+        public override void Update()

+        {

+            SimulationManager.Instance.RequestSimulation();

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(SimulationManager.Instance.LastStage.ActualThrust);

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Vessel/ThrustToWeight.cs
+++ b/KerbalEngineer/FlightEngineer/Vessel/ThrustToWeight.cs
@@ -1,32 +1,32 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Vessel
-{
-    public class ThrustToWeight : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "TWR";
-            Description = "Shows the vessel thrust to weight ratio.";
-            Category = ReadoutCategory.Vessel;
-        }
-
-        public override void Update()
-        {
-            SimulationManager.Instance.RequestSimulation();
-        }
-
-        public override void Draw()
-        {
-            DrawLine(SimulationManager.Instance.LastStage.TWR);
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Simulation;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Vessel

+{

+    public class ThrustToWeight : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "TWR";

+            this.Description = "Shows the vessel thrust to weight ratio.";

+            this.Category = ReadoutCategory.Vessel;

+        }

+

+        public override void Update()

+        {

+            SimulationManager.Instance.RequestSimulation();

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(SimulationManager.Instance.LastStage.TWR);

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Vessel/ThrustTotal.cs
+++ b/KerbalEngineer/FlightEngineer/Vessel/ThrustTotal.cs
@@ -1,32 +1,32 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Vessel
-{
-    public class ThrustTotal : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Thrust (Total)";
-            Description = "Shows the vessel thrust.";
-            Category = ReadoutCategory.Vessel;
-        }
-
-        public override void Update()
-        {
-            SimulationManager.Instance.RequestSimulation();
-        }
-
-        public override void Draw()
-        {
-            DrawLine(SimulationManager.Instance.LastStage.Thrust);
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Simulation;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Vessel

+{

+    public class ThrustTotal : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Thrust (Total)";

+            this.Description = "Shows the vessel thrust.";

+            this.Category = ReadoutCategory.Vessel;

+        }

+

+        public override void Update()

+        {

+            SimulationManager.Instance.RequestSimulation();

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(SimulationManager.Instance.LastStage.Thrust);

+        }

+    }

 }
-

--- a/KerbalEngineer/FlightEngineer/Vessel/TotalMass.cs
+++ b/KerbalEngineer/FlightEngineer/Vessel/TotalMass.cs
@@ -1,32 +1,32 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using System;
-using KerbalEngineer.Extensions;
-using KerbalEngineer.Simulation;
-using UnityEngine;
-
-namespace KerbalEngineer.FlightEngineer.Vessel
-{
-    public class TotalMass : Readout
-    {
-        protected override void Initialise()
-        {
-            Name = "Total Mass";
-            Description = "Shows the total mass for the vessel.";
-            Category = ReadoutCategory.Vessel;
-        }
-
-        public override void Update()
-        {
-            SimulationManager.Instance.RequestSimulation();
-        }
-
-        public override void Draw()
-        {
-            DrawLine(SimulationManager.Instance.LastStage.Mass);
-        }
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Simulation;

+

+#endregion

+

+namespace KerbalEngineer.FlightEngineer.Vessel

+{

+    public class TotalMass : Readout

+    {

+        protected override void Initialise()

+        {

+            this.Name = "Total Mass";

+            this.Description = "Shows the total mass for the vessel.";

+            this.Category = ReadoutCategory.Vessel;

+        }

+

+        public override void Update()

+        {

+            SimulationManager.Instance.RequestSimulation();

+        }

+

+        public override void Draw()

+        {

+            this.DrawLine(SimulationManager.Instance.LastStage.Mass);

+        }

+    }

 }
-

--- a/KerbalEngineer/KerbalEngineer.csproj
+++ b/KerbalEngineer/KerbalEngineer.csproj
@@ -1,123 +1,125 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{39806613-E0B7-46E0-89A6-A569EC538CBB}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>KerbalEngineer</RootNamespace>
-    <AssemblyName>KerbalEngineer</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>false</DebugSymbols>
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>..\Output\KerbalEngineer\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>..\Output\KerbalEngineer\</OutputPath>
-    <DefineConstants>
-    </DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <UseVSHostingProcess>false</UseVSHostingProcess>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="Assembly-CSharp">
-      <HintPath>..\Game\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-    <Reference Include="UnityEngine">
-      <HintPath>..\Game\KSP_Data\Managed\UnityEngine.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="BuildEngineer\BuildButton.cs" />
-    <Compile Include="BuildEngineer\BuildAdvanced.cs" />
-    <Compile Include="BuildEngineer\BuildOverlay.cs" />
-    <Compile Include="CelestialBodies.cs" />
-    <Compile Include="EngineerGlobals.cs" />
-    <Compile Include="Extensions\DoubleExtensions.cs" />
-    <Compile Include="Extensions\FloatExtensions.cs" />
-    <Compile Include="Extensions\PartExtensions.cs" />
-    <Compile Include="Extensions\PartResourceExtensions.cs" />
-    <Compile Include="Extensions\RectExtensions.cs" />
-    <Compile Include="FlightEngineer\InfoDisplay.cs" />
-    <Compile Include="FlightEngineer\EditDisplay.cs" />
-    <Compile Include="FlightEngineer\FlightController.cs" />
-    <Compile Include="FlightEngineer\FlightDisplay.cs" />
-    <Compile Include="FlightEngineer\FlightEngineer.cs" />
-    <Compile Include="FlightEngineer\Orbital\SemiMinorAxis.cs" />
-    <Compile Include="FlightEngineer\Orbital\SemiMajorAxis.cs" />
-    <Compile Include="FlightEngineer\Orbital\LongitudeOfPe.cs" />
-    <Compile Include="FlightEngineer\Orbital\LongitudeOfAN.cs" />
-    <Compile Include="FlightEngineer\Orbital\OrbitalPeriod.cs" />
-    <Compile Include="FlightEngineer\Orbital\Eccentricity.cs" />
-    <Compile Include="FlightEngineer\Orbital\Inclination.cs" />
-    <Compile Include="FlightEngineer\Orbital\TimeToPeriapsis.cs" />
-    <Compile Include="FlightEngineer\Orbital\PeriapsisHeight.cs" />
-    <Compile Include="FlightEngineer\Orbital\TimeToApoapsis.cs" />
-    <Compile Include="FlightEngineer\ReadoutList.cs" />
-    <Compile Include="FlightEngineer\Rendezvous\TargetSelector.cs" />
-    <Compile Include="FlightEngineer\SectionList.cs" />
-    <Compile Include="FlightEngineer\Orbital\ApoapsisHeight.cs" />
-    <Compile Include="FlightEngineer\Readout.cs" />
-    <Compile Include="FlightEngineer\Section.cs" />
-    <Compile Include="FlightEngineer\SectionWindow.cs" />
-    <Compile Include="FlightEngineer\Surface\AltitudeSeaLevel.cs" />
-    <Compile Include="FlightEngineer\Surface\AltitudeTerrain.cs" />
-    <Compile Include="FlightEngineer\Surface\AtmosphericDetails.cs" />
-    <Compile Include="FlightEngineer\Surface\AtmosEfficiency.cs" />
-    <Compile Include="FlightEngineer\Surface\TerminalVelocity.cs" />
-    <Compile Include="FlightEngineer\Surface\Latitude.cs" />
-    <Compile Include="FlightEngineer\Surface\Longitude.cs" />
-    <Compile Include="FlightEngineer\Surface\Horizontal Speed.cs" />
-    <Compile Include="FlightEngineer\Surface\VerticalSpeed.cs" />
-    <Compile Include="FlightEngineer\Vessel\ThrustActual.cs" />
-    <Compile Include="FlightEngineer\Vessel\ThrustToWeight.cs" />
-    <Compile Include="FlightEngineer\Vessel\ThrustTotal.cs" />
-    <Compile Include="FlightEngineer\Vessel\TotalMass.cs" />
-    <Compile Include="FlightEngineer\Vessel\SpecificImpulse.cs" />
-    <Compile Include="FlightEngineer\Vessel\DeltaVTotal.cs" />
-    <Compile Include="FlightEngineer\Vessel\DeltaVStaged.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Settings\Setting.cs" />
-    <Compile Include="Settings\SettingList.cs" />
-    <Compile Include="Simulation\PartSim.cs" />
-    <Compile Include="Simulation\ResourceContainer.cs" />
-    <Compile Include="Simulation\SimulationManager.cs" />
-    <Compile Include="Simulation\Simulation.cs" />
-    <Compile Include="Simulation\Stage.cs" />
-    <Compile Include="TapeDriveAnimator.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="FlightEngineer\Misc\" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <PropertyGroup>
-    <PostBuildEvent>xcopy "$(SolutionDir)Output\*" "$(SolutionDir)Game\GameData\*" /D /E /C /R /I /K /Y</PostBuildEvent>
-  </PropertyGroup>
+<?xml version="1.0" encoding="utf-8"?>

+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />

+  <PropertyGroup>

+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

+    <ProjectGuid>{39806613-E0B7-46E0-89A6-A569EC538CBB}</ProjectGuid>

+    <OutputType>Library</OutputType>

+    <AppDesignerFolder>Properties</AppDesignerFolder>

+    <RootNamespace>KerbalEngineer</RootNamespace>

+    <AssemblyName>KerbalEngineer</AssemblyName>

+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

+    <FileAlignment>512</FileAlignment>

+  </PropertyGroup>

+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

+    <DebugSymbols>false</DebugSymbols>

+    <DebugType>none</DebugType>

+    <Optimize>false</Optimize>

+    <OutputPath>..\Output\KerbalEngineer\</OutputPath>

+    <DefineConstants>DEBUG;TRACE</DefineConstants>

+    <ErrorReport>prompt</ErrorReport>

+    <WarningLevel>4</WarningLevel>

+    <UseVSHostingProcess>false</UseVSHostingProcess>

+  </PropertyGroup>

+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

+    <DebugType>none</DebugType>

+    <Optimize>true</Optimize>

+    <OutputPath>..\Output\KerbalEngineer\</OutputPath>

+    <DefineConstants>

+    </DefineConstants>

+    <ErrorReport>prompt</ErrorReport>

+    <WarningLevel>4</WarningLevel>

+    <UseVSHostingProcess>false</UseVSHostingProcess>

+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>

+  </PropertyGroup>

+  <ItemGroup>

+    <Reference Include="Assembly-CSharp">

+      <HintPath>..\Game\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>

+      <Private>False</Private>

+    </Reference>

+    <Reference Include="System" />

+    <Reference Include="System.Core" />

+    <Reference Include="System.Xml.Linq" />

+    <Reference Include="System.Data.DataSetExtensions" />

+    <Reference Include="System.Data" />

+    <Reference Include="System.Xml" />

+    <Reference Include="UnityEngine">

+      <HintPath>..\Game\KSP_Data\Managed\UnityEngine.dll</HintPath>

+      <Private>False</Private>

+    </Reference>

+  </ItemGroup>

+  <ItemGroup>

+    <Compile Include="BuildEngineer\BuildButton.cs" />

+    <Compile Include="BuildEngineer\BuildAdvanced.cs" />

+    <Compile Include="BuildEngineer\BuildOverlay.cs" />

+    <Compile Include="CelestialBodies.cs" />

+    <Compile Include="EngineerGlobals.cs" />

+    <Compile Include="Extensions\DoubleExtensions.cs" />

+    <Compile Include="Extensions\FloatExtensions.cs" />

+    <Compile Include="Extensions\PartExtensions.cs" />

+    <Compile Include="Extensions\PartResourceExtensions.cs" />

+    <Compile Include="Extensions\RectExtensions.cs" />

+    <Compile Include="FlightEngineer\InfoDisplay.cs" />

+    <Compile Include="FlightEngineer\EditDisplay.cs" />

+    <Compile Include="FlightEngineer\FlightController.cs" />

+    <Compile Include="FlightEngineer\FlightDisplay.cs" />

+    <Compile Include="FlightEngineer\FlightEngineer.cs" />

+    <Compile Include="FlightEngineer\Orbital\SemiMinorAxis.cs" />

+    <Compile Include="FlightEngineer\Orbital\SemiMajorAxis.cs" />

+    <Compile Include="FlightEngineer\Orbital\LongitudeOfPe.cs" />

+    <Compile Include="FlightEngineer\Orbital\LongitudeOfAN.cs" />

+    <Compile Include="FlightEngineer\Orbital\OrbitalPeriod.cs" />

+    <Compile Include="FlightEngineer\Orbital\Eccentricity.cs" />

+    <Compile Include="FlightEngineer\Orbital\Inclination.cs" />

+    <Compile Include="FlightEngineer\Orbital\TimeToPeriapsis.cs" />

+    <Compile Include="FlightEngineer\Orbital\PeriapsisHeight.cs" />

+    <Compile Include="FlightEngineer\Orbital\TimeToApoapsis.cs" />

+    <Compile Include="FlightEngineer\ReadoutList.cs" />

+    <Compile Include="FlightEngineer\Rendezvous\TargetSelector.cs" />

+    <Compile Include="FlightEngineer\SectionList.cs" />

+    <Compile Include="FlightEngineer\Orbital\ApoapsisHeight.cs" />

+    <Compile Include="FlightEngineer\Readout.cs" />

+    <Compile Include="FlightEngineer\Section.cs" />

+    <Compile Include="FlightEngineer\SectionWindow.cs" />

+    <Compile Include="FlightEngineer\Surface\AltitudeSeaLevel.cs" />

+    <Compile Include="FlightEngineer\Surface\AltitudeTerrain.cs" />

+    <Compile Include="FlightEngineer\Surface\AtmosphericDetails.cs" />

+    <Compile Include="FlightEngineer\Surface\AtmosEfficiency.cs" />

+    <Compile Include="FlightEngineer\Surface\TerminalVelocity.cs" />

+    <Compile Include="FlightEngineer\Surface\Latitude.cs" />

+    <Compile Include="FlightEngineer\Surface\Longitude.cs" />

+    <Compile Include="FlightEngineer\Surface\Horizontal Speed.cs" />

+    <Compile Include="FlightEngineer\Surface\VerticalSpeed.cs" />

+    <Compile Include="FlightEngineer\Vessel\ThrustActual.cs" />

+    <Compile Include="FlightEngineer\Vessel\ThrustToWeight.cs" />

+    <Compile Include="FlightEngineer\Vessel\ThrustTotal.cs" />

+    <Compile Include="FlightEngineer\Vessel\TotalMass.cs" />

+    <Compile Include="FlightEngineer\Vessel\SpecificImpulse.cs" />

+    <Compile Include="FlightEngineer\Vessel\DeltaVTotal.cs" />

+    <Compile Include="FlightEngineer\Vessel\DeltaVStaged.cs" />

+    <Compile Include="Properties\AssemblyInfo.cs" />

+    <Compile Include="Settings\Setting.cs" />

+    <Compile Include="Settings\SettingList.cs" />

+    <Compile Include="Simulation\PartSim.cs" />

+    <Compile Include="Simulation\ResourceContainer.cs" />

+    <Compile Include="Simulation\SimulationManager.cs" />

+    <Compile Include="Simulation\Simulation.cs" />

+    <Compile Include="Simulation\Stage.cs" />

+    <Compile Include="TapeDriveAnimator.cs" />

+  </ItemGroup>

+  <ItemGroup>

+    <Folder Include="FlightEngineer\Misc\" />

+  </ItemGroup>

+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

+  <PropertyGroup>

+    <PostBuildEvent>xcopy "$(SolutionDir)Output\*" "$(SolutionDir)Game\GameData\*" /E /Y</PostBuildEvent>

+  </PropertyGroup>

   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
   </Target>
   <Target Name="AfterBuild">
   </Target>
-  -->
+  -->

 </Project>

--- a/KerbalEngineer/Simulation/Stage.cs
+++ b/KerbalEngineer/Simulation/Stage.cs
@@ -1,130 +1,134 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-
-using KerbalEngineer.Extensions;
-
-namespace KerbalEngineer.Simulation
-{
-    public class Stage
-    {
-        #region Fields
-
-        public int number = 0;
-        public int cost = 0;
-        public int totalCost = 0;
-        public int partCount = 0;
-        public double time = 0d;
-        public double totalTime = 0d;
-        public double mass = 0d;
-        public double totalMass = 0d;
-        public double isp = 0d;
-        public double thrust = 0d;
-        public double actualThrust = 0d;
-        public double thrustToWeight = 0d;
-        public double actualThrustToWeight = 0d;
-        public double deltaV = 0d;
-        public double totalDeltaV = 0d;
-        public double inverseTotalDeltaV = 0d;
-
-        #endregion
-
-        #region Properties
-
-        public string Number
-        {
-            get { return "S" + number; }
-        }
-
-        public string Parts
-        {
-            get { return partCount.ToString(); }
-        }
-
-        public string Cost
-        {
-            get { return cost + " / " + totalCost; }
-        }
-
-        public string Mass
-        {
-            get
-            {
-                if (HighLogic.LoadedSceneIsFlight)
-                    return totalMass.ToMass();
-                else
-                    return mass.ToMass(false) + " / " + totalMass.ToMass();
-            }
-        }
-
-        public string Isp
-        {
-            get { return isp.ToString("#,0.00") + "s"; }
-        }
-
-        public string Thrust
-        {
-            get { return thrust.ToForce(); }
-        }
-
-        public string ActualThrust
-        {
-            get { return actualThrust.ToForce(); }
-        }
-
-        public string TWR
-        {
-            get
-            {
-                if (HighLogic.LoadedSceneIsFlight)
-                    return actualThrustToWeight.ToString("0.00") + " / " + thrustToWeight.ToString("0.00");
-                else
-                    return thrustToWeight.ToString("0.00");
-            }
-        }
-
-        public string DeltaV
-        {
-            get
-            {
-                if (HighLogic.LoadedSceneIsFlight)
-                    return deltaV.ToSpeed();
-                else
-                    return deltaV.ToString("#,0.") + " / " + inverseTotalDeltaV.ToString("#,0.") + "m/s";
-            }
-        }
-
-        public string TotalDeltaV
-        {
-            get
-            {
-                if (HighLogic.LoadedSceneIsFlight)
-                    return totalDeltaV.ToSpeed();
-                else
-                    return inverseTotalDeltaV.ToString("#,0.") + "m/s";
-            }
-        }
-
-        public string Time
-        {
-            get
-            {
-                return time.ToTime();
-            }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        public Stage() { }
-
-        public Stage(int stageNumber)
-        {
-            number = stageNumber;
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using KerbalEngineer.Extensions;

+

+#endregion

+

+namespace KerbalEngineer.Simulation

+{

+    public class Stage

+    {

+        #region Fields

+

+        public double actualThrust = 0;

+        public double actualThrustToWeight = 0;

+        public int cost = 0;

+        public double deltaV = 0;

+        public double inverseTotalDeltaV = 0;

+        public double isp = 0;

+        public double mass = 0;

+        public int number = 0;

+        public int partCount = 0;

+        public double thrust = 0;

+        public double thrustToWeight = 0;

+        public double time = 0;

+        public int totalCost = 0;

+        public double totalDeltaV = 0;

+        public double totalMass = 0;

+        public double totalTime = 0;

+

+        #endregion

+

+        #region Properties

+

+        public string Number

+        {

+            get { return "S" + this.number; }

+        }

+

+        public string Parts

+        {

+            get { return this.partCount.ToString(); }

+        }

+

+        public string Cost

+        {

+            get { return this.cost + " / " + this.totalCost; }

+        }

+

+        public string Mass

+        {

+            get

+            {

+                if (HighLogic.LoadedSceneIsFlight)

+                {

+                    return this.totalMass.ToMass();

+                }

+                return this.mass.ToMass(false) + " / " + this.totalMass.ToMass();

+            }

+        }

+

+        public string Isp

+        {

+            get { return this.isp.ToString("#,0.00") + "s"; }

+        }

+

+        public string Thrust

+        {

+            get { return this.thrust.ToForce(); }

+        }

+

+        public string ActualThrust

+        {

+            get { return this.actualThrust.ToForce(); }

+        }

+

+        public string TWR

+        {

+            get

+            {

+                if (HighLogic.LoadedSceneIsFlight)

+                {

+                    return this.actualThrustToWeight.ToString("0.00") + " / " + this.thrustToWeight.ToString("0.00");

+                }

+                return this.thrustToWeight.ToString("0.00");

+            }

+        }

+

+        public string DeltaV

+        {

+            get

+            {

+                if (HighLogic.LoadedSceneIsFlight)

+                {

+                    return this.deltaV.ToSpeed();

+                }

+                return this.deltaV.ToString("#,0.") + " / " + this.inverseTotalDeltaV.ToString("#,0.") + "m/s";

+            }

+        }

+

+        public string TotalDeltaV

+        {

+            get

+            {

+                if (HighLogic.LoadedSceneIsFlight)

+                {

+                    return this.totalDeltaV.ToSpeed();

+                }

+                return this.inverseTotalDeltaV.ToString("#,0.") + "m/s";

+            }

+        }

+

+        public string Time

+        {

+            get { return this.time.ToTime(); }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        public Stage() { }

+

+        public Stage(int stageNumber)

+        {

+            this.number = stageNumber;

+        }

+

+        #endregion

+    }

 }
-

--- a/KerbalEngineer/TapeDriveAnimator.cs
+++ b/KerbalEngineer/TapeDriveAnimator.cs
@@ -1,382 +1,374 @@
-// Name:    Kerbal Engineer Redux
-// Author:  CYBUTEK
-// License: Attribution-NonCommercial-ShareAlike 3.0 Unported
-//
-// This code is used to run the tape reel and light animations for the ER7500 part
-// that was created for me by Keptin.
-//
-// It is by all means possible to reuse this module with your own part that requires
-// the same kind of animation.  So feel free to use as you see fit :)
-
-using UnityEngine;
-
-namespace KerbalEngineer
-{
-    public class TapeDriveAnimator : PartModule
-    {
-        #region Fields
-
-        private System.Random _random;
-        private float _speed = 0f;
-        private float _targetSpeed = 0f;
-        private float _repeatTime = 0f;
-        private float _currentTime = 0f;
-        private float _deltaTime = 0f;
-        private bool _sceneIsEditor = false;
-        private bool _enabled = false;
-
-        private Shader _lightsShaderOn;
-        private Shader _lights1ShaderOff;
-        private Shader _lights2ShaderOff;
-        private Shader _lights3ShaderOff;
-        private Shader _lights4ShaderOff;
-        private Shader _lights5ShaderOff;
-        private Shader _lights6ShaderOff;
-
-        private Transform _reel1Transform;
-        private Transform _reel2Transform;
-        private Transform _lights1Transform;
-        private Transform _lights2Transform;
-        private Transform _lights3Transform;
-        private Transform _lights4Transform;
-        private Transform _lights5Transform;
-        private Transform _lights6Transform;
-
-        #endregion
-
-        #region KSP Fields
-
-        [KSPField]
-        public bool useBakedAnimation = false;
-
-        [KSPField]
-        public int minReelSpeed = 0;
-
-        [KSPField]
-        public int maxReelSpeed = 0;
-
-        [KSPField]
-        public float speedStopZone = 0;
-
-        [KSPField]
-        public float speedDeadZone = 0;
-
-        [KSPField]
-        public float speedChangeAmount = 0;
-
-        [KSPField]
-        public int minRepeatTime = 0;
-
-        [KSPField]
-        public int maxRepeatTime = 0;
-
-        [KSPField]
-        public float repeatTimeDenominator = 1;
-
-        [KSPField]
-        public string reel1 = "";
-
-        [KSPField]
-        public string reel2 = "";
-
-        [KSPField]
-        public float reel1SpeedRatio = 1;
-
-        [KSPField]
-        public float reel2SpeedRatio = 1;
-
-        [KSPField]
-        public string lights1 = "";
-
-        [KSPField]
-        public float lights1Speed = 0;
-
-        [KSPField]
-        public string lights2 = "";
-
-        [KSPField]
-        public float lights2Speed = 0;
-
-        [KSPField]
-        public string lights3 = "";
-
-        [KSPField]
-        public float lights3Speed = 0;
-
-        [KSPField]
-        public string lights4 = "";
-
-        [KSPField]
-        public float lights4Speed = 0;
-
-        [KSPField]
-        public string lights5 = "";
-
-        [KSPField]
-        public float lights5Speed = 0;
-
-        [KSPField]
-        public string lights6 = "";
-
-        [KSPField]
-        public float lights6Speed = 0;
-
-        #endregion
-
-        #region Properties
-
-        public bool Enabled
-        {
-            get { return _enabled; }
-            set
-            {
-                _enabled = value;
-
-                if (_enabled)
-                {
-                    if (useBakedAnimation)
-                        StartBakedAnimation();
-                }
-                else
-                {
-                    if (useBakedAnimation)
-                        StopBakedAnimation();
-                }
-            }
-        }
-
-        #endregion
-
-        #region Initialisation
-
-        public override void OnStart(StartState state)
-        {
-            _random = new System.Random();
-
-            StopBakedAnimation();
-            Enabled = false;
-
-            if (HighLogic.LoadedSceneIsEditor)
-            {
-                part.OnEditorAttach += OnEditorAttach;
-                part.OnEditorDetach += OnEditorDetach;
-
-                _sceneIsEditor = true;
-
-                if (part.parent != null)
-                    Enabled = true;
-            }
-            else if (HighLogic.LoadedSceneIsFlight)
-            {
-                Enabled = true;
-            }
-
-            if (!useBakedAnimation)
-            {
-                InitialiseReels();
-                InitialiseLights();
-            }
-        }
-
-        private void InitialiseReels()
-        {
-            if (reel1 != "")
-                _reel1Transform = part.FindModelTransform(reel1);
-
-            if (reel2 != "")
-                _reel2Transform = part.FindModelTransform(reel2);
-        }
-
-        private void InitialiseLights()
-        {
-            if (lights1 != "")
-            {
-                _lights1Transform = part.FindModelTransform(lights1);
-                _lights1ShaderOff = _lights1Transform.renderer.material.shader;
-            }
-
-            if (lights2 != "")
-            {
-                _lights2Transform = part.FindModelTransform(lights2);
-                _lights2ShaderOff = _lights2Transform.renderer.material.shader;
-            }
-
-            if (lights3 != "")
-            {
-                _lights3Transform = part.FindModelTransform(lights3);
-                _lights3ShaderOff = _lights3Transform.renderer.material.shader;
-            }
-
-            if (lights4 != "")
-            {
-                _lights4Transform = part.FindModelTransform(lights4);
-                _lights4ShaderOff = _lights4Transform.renderer.material.shader;
-            }
-
-            if (lights5 != "")
-            {
-                _lights5Transform = part.FindModelTransform(lights5);
-                _lights5ShaderOff = _lights5Transform.renderer.material.shader;
-            }
-
-            if (lights6 != "")
-            {
-                _lights6Transform = part.FindModelTransform(lights6);
-                _lights6ShaderOff = _lights6Transform.renderer.material.shader;
-            }
-
-            _lightsShaderOn = Shader.Find("Self-Illumin/Specular");
-        }
-
-        #endregion
-
-        #region Updating
-
-        public override void OnUpdate()
-        {
-            if (!useBakedAnimation)
-            {
-                if (_sceneIsEditor)
-                    _deltaTime = Time.deltaTime;
-                else
-                    _deltaTime = TimeWarp.deltaTime;
-
-                if (TimeWarp.CurrentRate == 1f || TimeWarp.WarpMode == TimeWarp.Modes.LOW)
-                {
-                    if (Enabled)
-                    {
-                        UpdateTimerCycle();
-                        UpdateSpeed();
-                        UpdateReels();
-                        UpdateLights();
-                    }
-                    else
-                    {
-                        _targetSpeed = 0f;
-                        if (_speed != 0)
-                        {
-                            UpdateSpeed();
-                            UpdateReels();
-                            UpdateLights();
-                        }
-                    }
-                }
-            }
-        }
-
-        public void Update()
-        {
-            if (_sceneIsEditor)
-                OnUpdate();
-        }
-
-        private void OnEditorAttach()
-        {
-            Enabled = true;
-        }
-
-        private void OnEditorDetach()
-        {
-            Enabled = false;
-        }
-
-        private void StopBakedAnimation()
-        {
-            foreach (Animation animation in part.FindModelAnimators())
-                animation.Stop();
-        }
-
-        private void StartBakedAnimation()
-        {
-            foreach (Animation animation in part.FindModelAnimators())
-                animation.Play();
-        }
-
-        private void UpdateTimerCycle()
-        {
-            _currentTime += _deltaTime;
-
-            if (_currentTime >= _repeatTime)
-            {
-                _targetSpeed = _random.Next(minReelSpeed, maxReelSpeed);
-
-                if (_targetSpeed > -speedStopZone && _targetSpeed < speedStopZone)
-                    _targetSpeed = 0f;
-
-                _repeatTime = _random.Next(minRepeatTime, maxRepeatTime);
-
-                if (repeatTimeDenominator != 0)
-                    _repeatTime /= repeatTimeDenominator;
-
-                _currentTime -= _repeatTime;
-            }
-        }
-
-        private void UpdateSpeed()
-        {
-            if (_speed < _targetSpeed)
-            {
-                if (_speed < _targetSpeed - speedDeadZone)
-                    _speed += speedChangeAmount * _deltaTime;
-                else
-                    _speed = _targetSpeed;
-            }
-            else if (_speed > _targetSpeed)
-            {
-                if (_speed > _targetSpeed + speedDeadZone)
-                    _speed -= speedChangeAmount * _deltaTime;
-                else
-                    _speed = _targetSpeed;
-            }
-        }
-
-        private void UpdateReels()
-        {
-            if (_reel1Transform != null && _speed != 0)
-                _reel1Transform.transform.Rotate(Vector3.right, _speed * reel1SpeedRatio);
-
-            if (_reel2Transform != null && _speed != 0)
-                _reel2Transform.transform.Rotate(Vector3.right, _speed * reel2SpeedRatio);
-        }
-
-        private void UpdateLights()
-        {
-            if (_lights1Transform != null)
-                UpdateLightTransform(_lights1Transform, _lightsShaderOn, _lights1ShaderOff, lights1Speed);
-
-            if (_lights2Transform != null)
-                UpdateLightTransform(_lights2Transform, _lightsShaderOn, _lights2ShaderOff, lights2Speed);
-
-            if (_lights3Transform != null)
-                UpdateLightTransform(_lights3Transform, _lightsShaderOn, _lights3ShaderOff, lights3Speed);
-
-            if (_lights4Transform != null)
-                UpdateLightTransform(_lights4Transform, _lightsShaderOn, _lights4ShaderOff, lights4Speed);
-
-            if (_lights5Transform != null)
-                UpdateLightTransform(_lights5Transform, _lightsShaderOn, _lights5ShaderOff, lights5Speed);
-
-            if (_lights6Transform != null)
-                UpdateLightTransform(_lights6Transform, _lightsShaderOn, _lights6ShaderOff, lights6Speed);
-        }
-
-        private void UpdateLightTransform(Transform lights, Shader on, Shader off, float targetSpeed)
-        {
-            bool lightsOn = false;
-
-            if (targetSpeed > 0)
-                lightsOn = (_speed > targetSpeed);
-            else if (targetSpeed < 0)
-                lightsOn = (_speed < targetSpeed);
-            else
-                lightsOn = (_speed == 0);
-
-            if (lightsOn)
-                lights.renderer.material.shader = on;
-            else
-                lights.renderer.material.shader = off;
-        }
-
-        #endregion
-    }
+// Project:	KerbalEngineer

+// Author:	CYBUTEK

+// License:	Attribution-NonCommercial-ShareAlike 3.0 Unported

+

+#region Using Directives

+

+using UnityEngine;

+

+using Random = System.Random;

+

+#endregion

+

+namespace KerbalEngineer

+{

+    public class TapeDriveAnimator : PartModule

+    {

+        #region Public Fields

+

+        [KSPField] public string Lights1 = "";

+        [KSPField] public float Lights1Speed = 0;

+        [KSPField] public string Lights2 = "";

+        [KSPField] public float Lights2Speed = 0;

+        [KSPField] public string Lights3 = "";

+        [KSPField] public float Lights3Speed = 0;

+        [KSPField] public string Lights4 = "";

+        [KSPField] public float Lights4Speed = 0;

+        [KSPField] public string Lights5 = "";

+        [KSPField] public float Lights5Speed = 0;

+        [KSPField] public string Lights6 = "";

+        [KSPField] public float Lights6Speed = 0;

+        [KSPField] public int MaxReelSpeed = 0;

+        [KSPField] public int MaxRepeatTime = 0;

+        [KSPField] public int MinReelSpeed = 0;

+        [KSPField] public int MinRepeatTime = 0;

+        [KSPField] public string Reel1 = "";

+        [KSPField] public float Reel1SpeedRatio = 1;

+        [KSPField] public string Reel2 = "";

+        [KSPField] public float Reel2SpeedRatio = 1;

+        [KSPField] public float RepeatTimeDenominator = 1;

+        [KSPField] public float SpeedChangeAmount = 0;

+        [KSPField] public float SpeedDeadZone = 0;

+        [KSPField] public float SpeedStopZone = 0;

+        [KSPField] public bool UseBakedAnimation = false;

+

+        #endregion

+

+        #region Private Fields

+

+        private float currentTime;

+        private float deltaTime;

+        private Shader lights1ShaderOff;

+        private Transform lights1Transform;

+        private Shader lights2ShaderOff;

+        private Transform lights2Transform;

+        private Shader lights3ShaderOff;

+        private Transform lights3Transform;

+        private Shader lights4ShaderOff;

+        private Transform lights4Transform;

+        private Shader lights5ShaderOff;

+        private Transform lights5Transform;

+        private Shader lights6ShaderOff;

+        private Transform lights6Transform;

+        private Shader lightsShaderOn;

+        private Random random;

+        private Transform reel1Transform;

+        private Transform reel2Transform;

+        private float repeatTime;

+        private bool sceneIsEditor;

+        private float speed;

+        private float targetSpeed;

+

+        #endregion

+

+        #region Properties

+

+        private bool isRunning;

+

+        public bool IsRunning

+        {

+            get { return this.isRunning; }

+            set

+            {

+                this.isRunning = value;

+

+                if (this.isRunning)

+                {

+                    if (this.UseBakedAnimation)

+                    {

+                        this.StartBakedAnimation();

+                    }

+                }

+                else

+                {

+                    if (this.UseBakedAnimation)

+                    {

+                        this.StopBakedAnimation();

+                    }

+                }

+            }

+        }

+

+        #endregion

+

+        #region Initialisation

+

+        public override void OnStart(StartState state)

+        {

+            this.random = new Random();

+

+            this.StopBakedAnimation();

+            this.IsRunning = false;

+

+            if (HighLogic.LoadedSceneIsEditor)

+            {

+                this.part.OnEditorAttach += this.OnEditorAttach;

+                this.part.OnEditorDetach += this.OnEditorDetach;

+

+                this.sceneIsEditor = true;

+

+                if (this.part.parent != null)

+                {

+                    this.IsRunning = true;

+                }

+            }

+            else if (HighLogic.LoadedSceneIsFlight)

+            {

+                this.IsRunning = true;

+            }

+

+            if (!this.UseBakedAnimation)

+            {

+                this.InitialiseReels();

+                this.InitialiseLights();

+            }

+        }

+

+        private void InitialiseReels()

+        {

+            if (this.Reel1 != "")

+            {

+                this.reel1Transform = this.part.FindModelTransform(this.Reel1);

+            }

+

+            if (this.Reel2 != "")

+            {

+                this.reel2Transform = this.part.FindModelTransform(this.Reel2);

+            }

+        }

+

+        private void InitialiseLights()

+        {

+            if (this.Lights1 != "")

+            {

+                this.lights1Transform = this.part.FindModelTransform(this.Lights1);

+                this.lights1ShaderOff = this.lights1Transform.renderer.material.shader;

+            }

+

+            if (this.Lights2 != "")

+            {

+                this.lights2Transform = this.part.FindModelTransform(this.Lights2);

+                this.lights2ShaderOff = this.lights2Transform.renderer.material.shader;

+            }

+

+            if (this.Lights3 != "")

+            {

+                this.lights3Transform = this.part.FindModelTransform(this.Lights3);

+                this.lights3ShaderOff = this.lights3Transform.renderer.material.shader;

+            }

+

+            if (this.Lights4 != "")

+            {

+                this.lights4Transform = this.part.FindModelTransform(this.Lights4);

+                this.lights4ShaderOff = this.lights4Transform.renderer.material.shader;

+            }

+

+            if (this.Lights5 != "")

+            {

+                this.lights5Transform = this.part.FindModelTransform(this.Lights5);

+                this.lights5ShaderOff = this.lights5Transform.renderer.material.shader;

+            }

+

+            if (this.Lights6 != "")

+            {

+                this.lights6Transform = this.part.FindModelTransform(this.Lights6);

+                this.lights6ShaderOff = this.lights6Transform.renderer.material.shader;

+            }

+

+            this.lightsShaderOn = Shader.Find("Self-Illumin/Diffuse");

+        }

+

+        #endregion

+

+        #region Updating

+

+        public override void OnUpdate()

+        {

+            if (!this.UseBakedAnimation)

+            {

+                this.deltaTime = this.sceneIsEditor ? Time.deltaTime : TimeWarp.deltaTime;

+

+                if (TimeWarp.CurrentRate != 1.0f && TimeWarp.WarpMode != TimeWarp.Modes.LOW)

+                {

+                    return;

+                }

+

+                if (this.IsRunning)

+                {

+                    this.UpdateTimerCycle();

+                    this.UpdateSpeed();

+                    this.UpdateReels();

+                    this.UpdateLights();

+                }

+                else

+                {

+                    this.targetSpeed = 0;

+

+                    if (this.speed != 0)

+                    {

+                        this.UpdateSpeed();

+                        this.UpdateReels();

+                        this.UpdateLights();

+                    }

+                }

+            }

+        }

+

+        private void Update()

+        {

+            if (this.sceneIsEditor)

+            {

+                this.OnUpdate();

+            }

+        }

+

+        private void OnEditorAttach()

+        {

+            this.IsRunning = true;

+        }

+

+        private void OnEditorDetach()

+        {

+            this.IsRunning = false;

+        }

+

+        private void StopBakedAnimation()

+        {

+            foreach (var animator in this.part.FindModelAnimators())

+            {

+                animator.Stop();

+            }

+        }

+

+        private void StartBakedAnimation()

+        {

+            foreach (var animator in this.part.FindModelAnimators())

+            {

+                animator.Play();

+            }

+        }

+

+        private void UpdateTimerCycle()

+        {

+            this.currentTime += this.deltaTime;

+

+            if (this.currentTime >= this.repeatTime)

+            {

+                this.targetSpeed = this.random.Next(this.MinReelSpeed, this.MaxReelSpeed);

+

+                if (this.targetSpeed > -this.SpeedStopZone && this.targetSpeed < this.SpeedStopZone)

+                {

+                    this.targetSpeed = 0;

+                }

+

+                this.repeatTime = this.random.Next(this.MinRepeatTime, this.MaxRepeatTime);

+

+                if (this.RepeatTimeDenominator != 0)

+                {

+                    this.repeatTime /= this.RepeatTimeDenominator;

+                }

+

+                this.currentTime -= this.repeatTime;

+            }

+        }

+

+        private void UpdateSpeed()

+        {

+            if (this.speed < this.targetSpeed)

+            {

+                if (this.speed < this.targetSpeed - this.SpeedDeadZone)

+                {

+                    this.speed += this.SpeedChangeAmount * this.deltaTime;

+                }

+                else

+                {

+                    this.speed = this.targetSpeed;

+                }

+            }

+            else if (this.speed > this.targetSpeed)

+            {

+                if (this.speed > this.targetSpeed + this.SpeedDeadZone)

+                {

+                    this.speed -= this.SpeedChangeAmount * this.deltaTime;

+                }

+                else

+                {

+                    this.speed = this.targetSpeed;

+                }

+            }

+        }

+

+        private void UpdateReels()

+        {

+            if (this.reel1Transform != null && this.speed != 0)

+            {

+                this.reel1Transform.transform.Rotate(Vector3.right, this.speed * this.Reel1SpeedRatio);

+            }

+

+            if (this.reel2Transform != null && this.speed != 0)

+            {

+                this.reel2Transform.transform.Rotate(Vector3.right, this.speed * this.Reel2SpeedRatio);

+            }

+        }

+

+        private void UpdateLights()

+        {

+            if (this.lights1Transform != null)

+            {

+                this.UpdateLightTransform(this.lights1Transform, this.lightsShaderOn, this.lights1ShaderOff, this.Lights1Speed);

+            }

+            if (this.lights2Transform != null)

+            {

+                this.UpdateLightTransform(this.lights2Transform, this.lightsShaderOn, this.lights2ShaderOff, this.Lights2Speed);

+            }

+            if (this.lights3Transform != null)

+            {

+                this.UpdateLightTransform(this.lights3Transform, this.lightsShaderOn, this.lights3ShaderOff, this.Lights3Speed);

+            }

+            if (this.lights4Transform != null)

+            {

+                this.UpdateLightTransform(this.lights4Transform, this.lightsShaderOn, this.lights4ShaderOff, this.Lights4Speed);

+            }

+            if (this.lights5Transform != null)

+            {

+                this.UpdateLightTransform(this.lights5Transform, this.lightsShaderOn, this.lights5ShaderOff, this.Lights5Speed);

+            }

+            if (this.lights6Transform != null)

+            {

+                this.UpdateLightTransform(this.lights6Transform, this.lightsShaderOn, this.lights6ShaderOff, this.Lights6Speed);

+            }

+        }

+

+        private void UpdateLightTransform(Component lights, Shader on, Shader off, float targetSpeed)

+        {

+            bool lightsOn;

+

+            if (targetSpeed > 0)

+            {

+                lightsOn = (this.speed > targetSpeed);

+            }

+            else if (targetSpeed < 0)

+            {

+                lightsOn = (this.speed < targetSpeed);

+            }

+            else

+            {

+                lightsOn = (this.speed == 0);

+            }

+

+            lights.renderer.material.shader = lightsOn ? @on : off;

+        }

+

+        #endregion

+    }

 }

--- a/Output/KerbalEngineer/Engineer7500/part.cfg
+++ b/Output/KerbalEngineer/Engineer7500/part.cfg
@@ -12,7 +12,7 @@
 	
 	// --- editor parameters ---
 	TechRequired = start
-  entryCost = 0
+	entryCost = 0
 	cost = 500
 	category = Science
 	subcategory = 0
@@ -38,41 +38,41 @@
 	
 	MODULE
 	{
-    name = FlightEngineer
-  }
+		name = FlightEngineer
+	}
 	
 	MODULE
 	{
 		name = TapeDriveAnimator
 		
-		useBakedAnimation = false
+		UseBakedAnimation = false
 		
-		minReelSpeed = -30
-		maxReelSpeed = 30
-		speedStopZone = 10
-		speedDeadZone = 2.5
-		speedChangeAmount = 30
-		minRepeatTime = 1
-		maxRepeatTime = 6
-		repeatTimeDenominator = 8
+		MinReelSpeed = -30
+		MaxReelSpeed = 30
+		SpeedStopZone = 10
+		SpeedDeadZone = 2.5
+		SpeedChangeAmount = 30
+		MinRepeatTime = 1
+		MaxRepeatTime = 6
+		RepeatTimeDenominator = 8
 		
-		reel1 = geo_reel1
-		reel2 = geo_reel2
-		reel1SpeedRatio = 1
-		reel2SpeedRatio = 0.75	
+		Reel1 = geo_reel1
+		Reel2 = geo_reel2
+		Reel1SpeedRatio = 1
+		Reel2SpeedRatio = 0.75	
 		
-		lights1 = geo_buttonSet1
-		lights2 = geo_buttonSet2
-		lights3 = geo_buttonSet3
-		lights4 = geo_buttonSet4
-		lights5 = geo_buttonSet5
-		lights6 = geo_buttonSet6
+		Lights1 = geo_buttonSet1
+		Lights2 = geo_buttonSet2
+		Lights3 = geo_buttonSet3
+		Lights4 = geo_buttonSet4
+		Lights5 = geo_buttonSet5
+		Lights6 = geo_buttonSet6
 		
-		lights1Speed = 0
-		lights2Speed = -2.5
-		lights3Speed = 2.5
-		lights4Speed = 10
-		lights5Speed = -15
-		lights6Speed = 17.5
+		Lights1Speed = 0
+		Lights2Speed = -2.5
+		Lights3Speed = 2.5
+		Lights4Speed = 10
+		Lights5Speed = -15
+		Lights6Speed = 17.5
 	}
 }

 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ