Exemple #1
0
        public void logSet(bool urlResult)
        {
            //} while (KSP.IO.File.Exists<IDisposable>(filename));
            //System.IO.File.WriteAllBytes(filename, bytes);

            KSP.IO.TextWriter fileWriter = KSP.IO.TextWriter.CreateForType <IDisposable>("asdf.asdf");//thanks kethane SVN :) https://mmi-kethane-plugin.googlecode.com/svn-history/r2/trunk/Controller.cs
            fileWriter.WriteLine(JsonConvert.SerializeObject(dataLog));
            fileWriter.Close();
            //KSP.IO.File.WriteAllText<MuMechJebPod2>(KSP.IO.File.ReadAllText<MuMechJebPod2>(KSPUtil.ApplicationRootPath + "Parts/mumech_MechJebPod2/default.craft"), KSPUtil.ApplicationRootPath + "Ships/__mechjebpod_tmp.craft");
            //System.IO.File.Copy(KSPUtil.ApplicationRootPath + "Parts/mumech_MechJebPod2/default.craft", KSPUtil.ApplicationRootPath + "Ships/__mechjebpod_tmp.craft", true);
        }
Exemple #2
0
        private static void SaveFile()
        {
            KSP.IO.TextWriter tw = KSP.IO.TextWriter.CreateForType <EvaSettings>(String.Format("Evas-{0}.txt", HighLogic.CurrentGame.Title));

            foreach (var item in collection)
            {
                tw.Write("[" + item.Value + "]");
            }

            tw.Close();

            collection.Clear();
        }
Exemple #3
0
 public void SaveAlarms2()
 {
     KACWorker.DebugLogFormatted("Saving Alarms");
     KSP.IO.TextWriter tw = KSP.IO.TextWriter.CreateForType <KerbalAlarmClock>(String.Format("Alarms-{0}.txt", HighLogic.CurrentGame.Title));
     //Write the header
     tw.WriteLine("VesselID|Name|Notes|AlarmTime.UT|AlarmMarginSecs|Type|Enabled|HaltWarp|PauseGame|Options-Manuever/Xfer/Target|<ENDLINE>");
     foreach (KACAlarm tmpAlarm in Alarms.BySaveName(HighLogic.CurrentGame.Title))
     {
         //Now Write Each alarm
         //tw.WriteLine(tmpAlarm.SerializeString2() + "|<ENDLINE>");
         tw.WriteLine(tmpAlarm.SerializeString3() + "|<ENDLINE>");
     }
     //And close the file
     tw.Close();
     KACWorker.DebugLogFormatted("Saved Alarms");
 }
Exemple #4
0
 public static void SaveConfiguration()
 {
     KSP.IO.TextWriter tr = KSP.IO.TextWriter.CreateForType <EvaSettings>("Config.cfg");
     tr.Write("ShowDebugLines = false");
     tr.Write("# 0 = left, 1 = right, 2 = middle mouse button.");
     tr.Write("SelectMouseButton = 0");
     tr.Write("DispatchMouseButton = 2");
     tr.Write("# Lookup Unity Keybinding for different options");
     tr.Write("# use lower case or eat exception sandwich. ");
     tr.Write("SelectKey = o");
     tr.Write("DispatchKey = p");
     tr.Write("");
     tr.Write("ShowLoadingKerbals = false");
     tr.Write("EnableHelmetToggle = true");
     tr.Close();
 }
Exemple #5
0
        public void SaveAlarms(Boolean BypassLogging = false)
        {
            if (!BypassLogging)
            {
                KACWorker.DebugLogFormatted("Saving Alarms-v3");
            }

            KSP.IO.TextWriter tw = KSP.IO.TextWriter.CreateForType <KerbalAlarmClock>(String.Format("Alarms-{0}.txt", HighLogic.CurrentGame.Title));
            //Write the header
            tw.WriteLine("AlarmsFileVersion|3|<ENDLINE>");
            tw.WriteLine("VesselID|Name|Notes|AlarmTime.UT|AlarmMarginSecs|Type|Enabled|HaltWarp|PauseGame|ActionedAt|Manuever|Xfer|Target|Options|<ENDLINE>");
            foreach (KACAlarm tmpAlarm in Alarms.BySaveName(HighLogic.CurrentGame.Title))
            {
                //Now Write Each alarm
                tw.WriteLine(tmpAlarm.SerializeString3() + "|<ENDLINE>");
            }
            //And close the file
            tw.Close();
        }
 /// <summary>
 /// Writes the object into the passed file. (uses KSP.IO)
 /// </summary>
 /// <param name="obj">Object.</param>
 /// <param name="path">Path.</param>
 public void writeObject(object obj, String path)
 {
     KSP.IO.TextWriter writer = KSP.IO.TextWriter.CreateForType <MissionController> (path);
     writeObject(writer, obj);
     writer.Close();
 }
Exemple #7
0
 /// <summary>
 /// Writes the object into the passed file. (uses KSP.IO)
 /// </summary>
 /// <param name="obj">Object.</param>
 /// <param name="path">Path.</param>
 public void writeObject(object obj, String path)
 {
     KSP.IO.TextWriter writer = KSP.IO.TextWriter.CreateForType <KerbalStuffVersion_BOM>(path);
     writeObject(writer, obj);
     writer.Close();
 }