public void SaveActiveToSaveData() { string SavedFile = KSPUtil.ApplicationRootPath + "/saves/" + HighLogic.SaveFolder + "/KCT_Settings.cfg"; ActivePreset.SaveToFile(SavedFile); }
public static void DrawPresetSaveWindow(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Preset name:"); saveName = GUILayout.TextField(saveName, GUILayout.Width(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Preset short name:"); saveShort = GUILayout.TextField(saveShort, GUILayout.Width(100)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Preset author(s):"); saveAuthor = GUILayout.TextField(saveAuthor, GUILayout.Width(100)); GUILayout.EndHorizontal(); //GUILayout.BeginHorizontal(); GUILayout.Label("Preset description:"); saveDesc = GUILayout.TextField(saveDesc, GUILayout.Width(220)); //GUILayout.EndHorizontal(); saveCareer = GUILayout.Toggle(saveCareer, " Show in Career Games"); saveScience = GUILayout.Toggle(saveScience, " Show in Science Games"); saveSandbox = GUILayout.Toggle(saveSandbox, " Show in Sandbox Games"); KCT_Preset existing = KCT_PresetManager.Instance.FindPresetByShortName(saveShort); bool AlreadyExists = existing != null; bool CanOverwrite = AlreadyExists ? existing.AllowDeletion : true; if (AlreadyExists) { GUILayout.Label("Warning: A preset with that short name already exists!"); } GUILayout.BeginHorizontal(); if (CanOverwrite && GUILayout.Button("Save")) { toSave.name = saveName; toSave.shortName = saveShort; toSave.description = saveDesc; toSave.author = saveAuthor; toSave.CareerEnabled = saveCareer; toSave.ScienceEnabled = saveScience; toSave.SandboxEnabled = saveSandbox; toSave.AllowDeletion = true; toSave.SaveToFile(KSPUtil.ApplicationRootPath + "/GameData/KerbalConstructionTime/KCT_Presets/" + toSave.shortName + ".cfg"); showPresetSaver = false; KCT_PresetManager.Instance.FindPresetFiles(); KCT_PresetManager.Instance.LoadPresets(); } if (GUILayout.Button("Cancel")) { showPresetSaver = false; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); CenterWindow(ref presetNamingWindowPosition); }
public void SaveActiveToSaveData() { ActivePreset.SaveToFile(SettingsFilePath); }