Generally converted only to use non-deprecated ToadicusTools methods.
[VOID.git] / VOID_DataLogger.cs
blob:a/VOID_DataLogger.cs -> blob:b/VOID_DataLogger.cs
--- a/VOID_DataLogger.cs
+++ b/VOID_DataLogger.cs
@@ -26,13 +26,12 @@
 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// TODO: Remove ToadicusTools. prefixes after refactor is done.
-
 using KSP;
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Text;
+using ToadicusTools;
 using ToadicusTools.DebugTools;
 using ToadicusTools.GUIUtils;
 using ToadicusTools.Text;
@@ -107,14 +106,11 @@
 			{
 				if (this._fileName == null || this._fileName == string.Empty)
 				{
-					this._fileName = KSP.IO.IOUtils.GetFilePathFor(
-						typeof(VOIDCore),
-						string.Format(
-							"{0}_{1}",
-							this.Vessel.vesselName,
-							"data.csv"
-						),
-						null
+					this._fileName = string.Format(
+						"{0}/{1}_{2}",
+						this.core.SaveGamePath,
+						this.Vessel.vesselName,
+						"data.csv"
 					);
 				}
 
@@ -237,9 +233,9 @@
 
 		#region VOID_Module Overrides
 
-		public override void LoadConfig()
-		{
-			base.LoadConfig();
+		public override void LoadConfig(KSP.IO.PluginConfiguration config)
+		{
+			base.LoadConfig(config);
 
 			this.logIntervalStr = this.logInterval.value.ToString("#.0##");
 		}
@@ -326,15 +322,18 @@
 						"\"Surface Longitude (°)\"," +
 						"\"Apoapsis Altitude (m)\"," +
 						"\"Periapsis Altitude (m)\"," +
+						"\"Orbital Inclination (°)\"," +
 						"\"Orbital Velocity (m/s)\"," +
 						"\"Surface Velocity (m/s)\"," +
 						"\"Vertical Speed (m/s)\"," +
 						"\"Horizontal Speed (m/s)\"," +
+						"\"Current Thrust (kN)\"," +
 						"\"Gee Force (gees)\"," +
 						"\"Temperature (°C)\"," +
 						"\"Gravity (m/s²)\"," +
 						"\"Atmosphere Density (g/m³)\"," +
 						"\"Downrange Distance  (m)\"," +
+						"\"Main Throttle\"," +
 						"\n"
 					);
 				}
@@ -348,67 +347,79 @@
 				line.Append(',');
 
 				//Altitude ASL
-				line.Append(VOID_Data.orbitAltitude.Value.ToString("F3"));
+				line.Append(VOID_Data.orbitAltitude.Value.ToString("G9"));
 				line.Append(',');
 
 				//Altitude (true)
-				line.Append(VOID_Data.trueAltitude.Value.ToString("F3"));
+				line.Append(VOID_Data.trueAltitude.Value.ToString("G9"));
 				line.Append(',');
 
 				// Surface Latitude
 				line.Append('"');
-				line.Append(VOID_Data.surfLatitude.Value);
+				line.Append(VOID_Data.surfLatitude.Value.ToString("F3"));
 				line.Append('"');
 				line.Append(',');
 
 				// Surface Longitude
 				line.Append('"');
-				line.Append(VOID_Data.surfLongitude.Value);
+				line.Append(VOID_Data.surfLongitude.Value.ToString("F3"));
 				line.Append('"');
 				line.Append(',');
 
 				// Apoapsis Altitude
-				line.Append(VOID_Data.orbitApoAlt.Value.ToString("G3"));
+				line.Append(VOID_Data.orbitApoAlt.Value.ToString("G9"));
 				line.Append(',');
 
 				// Periapsis Altitude
-				line.Append(VOID_Data.oribtPeriAlt.Value.ToString("G3"));
+				line.Append(VOID_Data.oribtPeriAlt.Value.ToString("G9"));
+				line.Append(',');
+
+				// Orbital Inclination
+				line.Append(VOID_Data.orbitInclination.Value.ToString("F2"));
 				line.Append(',');
 
 				//Orbital velocity
-				line.Append(VOID_Data.orbitVelocity.Value.ToString("F3"));
+				line.Append(VOID_Data.orbitVelocity.Value.ToString("G9"));
 				line.Append(',');
 
 				//surface velocity
-				line.Append(VOID_Data.surfVelocity.Value.ToString("F3"));
+				line.Append(VOID_Data.surfVelocity.Value.ToString("G9"));
 				line.Append(',');
 
 				//vertical speed
-				line.Append(VOID_Data.vertVelocity.Value.ToString("F3"));
+				line.Append(VOID_Data.vertVelocity.Value.ToString("G9"));
 				line.Append(',');
 
 				//horizontal speed
-				line.Append(VOID_Data.horzVelocity.Value.ToString("F3"));
+				line.Append(VOID_Data.horzVelocity.Value.ToString("G9"));
+				line.Append(',');
+
+				// Current Thrust
+				line.Append(VOID_Data.currThrust.Value.ToString("G9"));
 				line.Append(',');
 
 				//gee force
-				line.Append(VOID_Data.geeForce.Value.ToString("F3"));
+				line.Append(VOID_Data.geeForce.Value.ToString("G9"));
 				line.Append(',');
 
 				//temperature
-				line.Append(VOID_Data.temperature.Value.ToString("F2"));
+				line.Append(VOID_Data.temperature.Value.ToString("F3"));
 				line.Append(',');
 
 				//gravity
-				line.Append(VOID_Data.gravityAccel.Value.ToString("F3"));
+				line.Append(VOID_Data.gravityAccel.Value.ToString("G9"));
 				line.Append(',');
 
 				//atm density
-				line.Append(VOID_Data.atmDensity.Value.ToString("G3"));
+				line.Append(VOID_Data.atmDensity.Value.ToString("G9"));
 				line.Append(',');
 
 				// Downrange Distance
-				line.Append((VOID_Data.downrangeDistance.Value.ToString("G3")));
+				line.Append((VOID_Data.downrangeDistance.Value.ToString("G9")));
+				line.Append(',');
+
+				// Main Throttle
+				line.Append(VOID_Data.mainThrottle.Value.ToString("P2"));
 
 				line.Append('\n');
 
@@ -424,7 +435,7 @@
 
 		protected void AsyncWriteCallback(IAsyncResult result)
 		{
-			ToadicusTools.Logging.PostDebugMessage(this, "Got async callback, IsCompleted = {0}", result.IsCompleted);
+			Logging.PostDebugMessage(this, "Got async callback, IsCompleted = {0}", result.IsCompleted);
 
 			this.outputFile.EndWrite(result);
 			this.outstandingWrites--;