Пример #1
0
        public static float LoadStep <T>(float defStep = 1f)
        {
            double stepMult;

            stepMult = (double)defStep;

            try
            {
                KSP.IO.PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <T>();

                config.load();

                stepMult = config.GetValue("stepMult", stepMult);

                config.save();
            }
            catch (Exception e)
            {
                Logging.PostErrorMessage(
                    "{0} handled while loading PluginData for type {1}: do you have a malformed XML file?",
                    e.GetType().FullName,
                    typeof(T).Name
                    );

                Logging.PostDebugMessage(e.ToString());
            }

            return((float)stepMult);
        }
Пример #2
0
        public static void SaveConfigs()
        {
            config.SetValue("uiRectWindowEditor", uiRectWindowEditor);
            config.SetValue("uiRectWindowDebug", uiRectWindowDebug);

            config.SetValue("logCAV", WPDebug.logCAV.ToString());
            config.SetValue("logUpdate", WPDebug.logUpdate.ToString());
            config.SetValue("logUpdateGeometry", WPDebug.logUpdateGeometry.ToString());

            config.SetValue("logUpdateMaterials", WPDebug.logUpdateMaterials.ToString());
            config.SetValue("logMeshReferences", WPDebug.logMeshReferences.ToString());
            config.SetValue("logCheckMeshFilter", WPDebug.logCheckMeshFilter.ToString());

            config.SetValue("logPropertyWindow", WPDebug.logPropertyWindow.ToString());
            config.SetValue("logFlightSetup", WPDebug.logFlightSetup.ToString());
            config.SetValue("logFieldSetup", WPDebug.logFieldSetup.ToString());

            config.SetValue("logFuel", WPDebug.logFuel.ToString());
            config.SetValue("logLimits", WPDebug.logLimits.ToString());
            config.SetValue("logEvents", WPDebug.logEvents.ToString());

            //Prefs
            config.SetValue("AnglePref", WingProcedural.sharedPropAnglePref.ToString());
            //config.SetValue("EdgePref", WingProcedural.sharedPropEdgePref.ToString());
            config.SetValue("ThickPref", WingProcedural.sharedPropEThickPref.ToString());

            config.save();
        }
Пример #3
0
        public static Vector2 LoadBounds <T>()
        {
            Vector2 bounds = new Vector2(float.NegativeInfinity, float.PositiveInfinity);

            try
            {
                KSP.IO.PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <T>();

                config.load();

                bounds = config.GetValue("bounds", bounds);

                config.save();
            }
            catch (Exception e)
            {
                Logging.PostErrorMessage(
                    "{0} handled while loading PluginData for type {1}: do you have a malformed XML file?",
                    e.GetType().FullName,
                    typeof(T).Name
                    );

                Logging.PostDebugMessage(e.ToString());
            }

            return(bounds);
        }
        internal void SaveConfig()
        {
            Debug.Log("[Adjustable Mod Panel] Saving settings.");
            KSP.IO.PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <AdjustableModPanel> (null);
            int i = 1;

            foreach (var mod in descriptors)
            {
                if (mod.unmanageable)
                {
                    continue;
                }
                // artifact from an old config
                if (mod.textureHashNeeded && mod.textureHash == 0u)
                {
                    continue;
                }
                config["module" + i.ToString()]     = mod.module;
                config["method" + i.ToString()]     = mod.method;
                config["hashNeeded" + i.ToString()] = mod.textureHashNeeded;
                if (mod.textureHashNeeded)
                {
                    config["hash" + i.ToString()] = (long)mod.textureHash;
                }
                config["scenes" + i.ToString()] = (int)currentScenes[mod];
                config["pinned" + i.ToString()] = pinnedMods[mod];
                i++;
            }
            config["count"] = i - 1;
            config.save();
        }
Пример #5
0
        public void LoadConfig()
        {
            if (config == null)
            {
                config = KSP.IO.PluginConfiguration.CreateForType <SaturableRW> ();
            }

            config.load();

            if (!config.GetValue("DefaultStateIsActive", true) && vessel.atmDensity > 0.001)
            {
                wheelRef.State = ModuleReactionWheel.WheelState.Disabled;
            }

            if (!config.GetValue("DisplayCurrentTorque", false))
            {
                Fields ["availablePitchTorque"].guiActive = false;
                Fields ["availableRollTorque"].guiActive  = false;
                Fields ["availableYawTorque"].guiActive   = false;
            }

            dischargeTorque |= config.GetValue("dischargeTorque", false);

            // Save the file so it can be activated by anyone.

            config ["DefaultStateIsActive"] = config.GetValue("DefaultStateIsActive", true);
            config ["DisplayCurrentTorque"] = config.GetValue("DisplayCurrentTorque", false);
            config ["dischargeTorque"]      = config.GetValue("dischargeTorque", false);

            config.save();
        }
Пример #6
0
 public static void SaveToXml()
 {
     KSP.IO.PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <SettingsLoader>();
     config.SetValue("guiwindowPosition", guiwindowPosition);
     config.SetValue("showConfig", showConfigs);
     config.SetValue("guiIsActive", guiIsActive);
     config.save();
 }
 void SaveConfigs()
 {
     KSP.IO.PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <FlightGUI>();
     config.SetValue("flight_mainGuiRect", mainGuiRect);
     config.SetValue("flight_dataGuiRect", dataGuiRect);
     config.SetValue("flight_settingsGuiRect", settingsGuiRect);
     config.save();
 }
Пример #8
0
 public void SaveLoadObjects()
 {
     KACWorker.DebugLogFormatted("Saving Load Objects");
     KSP.IO.PluginConfiguration configfile = KSP.IO.PluginConfiguration.CreateForType <KerbalAlarmClock>();
     configfile.load();
     configfile.SetValue("LoadManNode", this.LoadManNode);
     configfile.SetValue("LoadVesselTarget", this.LoadVesselTarget);
     configfile.save();
     KACWorker.DebugLogFormatted("Saved Load Objects");
 }
Пример #9
0
        public void SaveSettingsToConfig()
        {
            KSP.IO.PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <EnginesFlightGUI>();
            //config.SetValue("showFlightWindow", FlightGUI.ShowFlightGUIWindow);

            config.SetValue("flightWindowPos", FlightWindowPos);

            FlightGUISettings.SaveSettings(ref config);
            GUIUnitsSettings.SaveSettings(ref config);

            config.save();
        }
 public void SaveConfig()
 {
     Log.dbg("Saving settings: {0} {1} {2} {3} {4} {5} {6} {7}", InteriorVolumeScale, InteriorMaxFreq, LowerMachThreshold, UpperMachThreshold, MaxDistortion, CondensationEffectStrength, MaxVacuumFreq, MaxSupersonicFreq);
     Config.SetValue("InteriorVolumeScale", InteriorVolumeScale.ToString());
     Config.SetValue("InteriorMaxFreq", InteriorMaxFreq.ToString());
     Config.SetValue("LowerMachThreshold", LowerMachThreshold.ToString());
     Config.SetValue("UpperMachThreshold", UpperMachThreshold.ToString());
     Config.SetValue("MaxDistortion", MaxDistortion.ToString());
     Config.SetValue("CondensationEffectStrength", CondensationEffectStrength.ToString());
     Config.SetValue("MaxVacuumFreq", MaxVacuumFreq.ToString());
     Config.SetValue("MaxSupersonicFreq", MaxSupersonicFreq.ToString());
     Config.save();
 }
Пример #11
0
        public static void SaveConfigs(ConfigNode node)
        {
            node.AddValue("allowStructuralFailures", FARDebugValues.allowStructuralFailures);
            node.AddValue("showMomentArrows", FARDebugValues.showMomentArrows);
            node.AddValue("useBlizzyToolbar", FARDebugValues.useBlizzyToolbar & ToolbarManager.ToolbarAvailable);
            node.AddValue("aeroFailureExplosions", FARDebugValues.aeroFailureExplosions);

            FARAeroUtil.SaveCustomAeroDataToConfig();
            FARAeroStress.SaveCustomStressTemplates();
            FARActionGroupConfiguration.SaveConfigruration();
            GUIColors.Instance.SaveColors();
            config.save();
        }
Пример #12
0
        private void SaveSettings()
        {
            KSPLog.print("[kalculator.dll] Saving Config...");
            KSP.IO.PluginConfiguration _configfile = KSP.IO.PluginConfiguration.CreateForType <Kalculator>();

            _configfile.SetValue("windowpos", _calcsize);
            _configfile.SetValue("keybind", _keybind);
            _configfile.SetValue("version", _version);
            _configfile.SetValue("KSPSkin", _useKspSkin);

            _configfile.save();
            print("[kalculator.dll] Config Saved ");
        }
 public void SaveConfig()
 {
     Debug.Log("ASE -- Saving settings: " + InteriorVolumeScale + " " + InteriorMaxFreq + " " + LowerMachThreshold + " " + UpperMachThreshold + " " + MaxDistortion + " " + CondensationEffectStrength + " " + MaxVacuumFreq + " " + MaxSupersonicFreq);
     Config.SetValue("InteriorVolumeScale", InteriorVolumeScale.ToString());
     Config.SetValue("InteriorMaxFreq", InteriorMaxFreq.ToString());
     Config.SetValue("LowerMachThreshold", LowerMachThreshold.ToString());
     Config.SetValue("UpperMachThreshold", UpperMachThreshold.ToString());
     Config.SetValue("MaxDistortion", MaxDistortion.ToString());
     Config.SetValue("CondensationEffectStrength", CondensationEffectStrength.ToString());
     Config.SetValue("MaxVacuumFreq", MaxVacuumFreq.ToString());
     Config.SetValue("MaxSupersonicFreq", MaxSupersonicFreq.ToString());
     Config.save();
 }
        public void SaveState(ConfigNode configNode)
        {
            KSP.IO.PluginConfiguration pluginConfig = KSP.IO.PluginConfiguration.CreateForType <AdvancedFlyByWire>();
            if (pluginConfig != null)
            {
                pluginConfig["useStockSkin"]           = m_UseKSPSkin;
                pluginConfig["useOldPresetEditor"]     = m_UseOldPresetsWindow;
                pluginConfig["usePrecisionModeFactor"] = m_UsePrecisionModeFactor;
                pluginConfig["precisionModeFactor"]    = m_PrecisionModeFactor.ToString();
                pluginConfig.save();
            }

            Configuration.Serialize(GetAbsoluteConfigurationPath(), m_Configuration);
        }
        public static void SaveConfigs()
        {
            config.SetValue("displayForces", FARDebugValues.displayForces.ToString());
            config.SetValue("displayCoefficients", FARDebugValues.displayCoefficients.ToString());
            config.SetValue("displayShielding", FARDebugValues.displayShielding.ToString());

            config.SetValue("useSplinesForSupersonicMath", FARDebugValues.useSplinesForSupersonicMath.ToString());
            config.SetValue("allowStructuralFailures", FARDebugValues.allowStructuralFailures.ToString());

            FARAeroUtil.SaveCustomAeroDataToConfig();
            FARPartClassification.SaveCustomClassificationTemplates();
            FARAeroStress.SaveCustomStressTemplates();
            config.save();
        }
Пример #16
0
        public void SaveConfig()
        {
            KSP.IO.PluginConfiguration config = KSP.IO.PluginConfiguration.CreateForType <PartCatalog>();

            foreach (FieldInfo field in GetType().GetFields(BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Public))
            {
                foreach (Attribute at in field.GetCustomAttributes(false))
                {
                    if (at is SaveToConfig)
                    {
                        config.SetValue(field.Name, field.GetValue(this));
                    }
                }
            }
            config.save();
        }
        public static void SaveConfigs()
        {
            config.SetValue("displayForces", FARDebugValues.displayForces.ToString());
            config.SetValue("displayCoefficients", FARDebugValues.displayCoefficients.ToString());
            config.SetValue("displayShielding", FARDebugValues.displayShielding.ToString());

            config.SetValue("useSplinesForSupersonicMath", FARDebugValues.useSplinesForSupersonicMath.ToString());
            config.SetValue("allowStructuralFailures", FARDebugValues.allowStructuralFailures.ToString());

            config.SetValue("useBlizzyToolbar", FARDebugValues.useBlizzyToolbar.ToString());

            FARDebugValues.useBlizzyToolbar &= ToolbarManager.ToolbarAvailable;

            FARAeroUtil.SaveCustomAeroDataToConfig();
            FARPartClassification.SaveCustomClassificationTemplates();
            FARAeroStress.SaveCustomStressTemplates();
            FARActionGroupConfiguration.SaveConfigruration();
            FAREditorGUI.SaveCustomColors();
            config.save();
        }
Пример #18
0
        //private static readonly Color _maneuverColour = new Color(0, 0.1137f, 1, _manueverAlpha);

        public void Save()
        {
            Utilities.DebugLogFormatted(LogLevel.Diagnostic, "Settings save");
            KSP.IO.PluginConfiguration configfile = KSP.IO.PluginConfiguration.CreateForType <EnhancedNavBall>();
            configfile.load();

            configfile.SetValue(_iconpos, IconPos);
            configfile.SetValue(_windowvisiblebyactivescene, WindowVisibleByActiveScene);
            configfile.SetValue(_navballposition, HandleFloatSave(NavballPosition));
            configfile.SetValue(_navballscale, HandleFloatSave(NavballScale));
            configfile.SetValue(_ghostposition, HandleFloatSave(GhostPosition));
            configfile.SetValue(_proRetColour, HandleColourSave(ProRetColour));
            configfile.SetValue(_normalColour, HandleColourSave(NormalColour));
            configfile.SetValue(_radialColour, HandleColourSave(RadialColour));
            configfile.SetValue(_enbManeuver, ENBManeuver);
            configfile.SetValue(_radialNormalDuringManeuver, RadialNormalDuringManeuver);
            //configfile.SetValue("");


            configfile.save();
        }
Пример #19
0
        public static void SaveConfigs()
        {
            config.SetValue("uiRectWindowEditor", uiRectWindowEditor);
            config.SetValue("uiRectWindowDebug", uiRectWindowDebug);

            config.SetValue("logCAV", WPDebug.logCAV.ToString());
            config.SetValue("logUpdate", WPDebug.logUpdate.ToString());
            config.SetValue("logUpdateGeometry", WPDebug.logUpdateGeometry.ToString());

            config.SetValue("logUpdateMaterials", WPDebug.logUpdateMaterials.ToString());
            config.SetValue("logMeshReferences", WPDebug.logMeshReferences.ToString());
            config.SetValue("logCheckMeshFilter", WPDebug.logCheckMeshFilter.ToString());

            config.SetValue("logPropertyWindow", WPDebug.logPropertyWindow.ToString());
            config.SetValue("logFlightSetup", WPDebug.logFlightSetup.ToString());
            config.SetValue("logFieldSetup", WPDebug.logFieldSetup.ToString());

            config.SetValue("logFuel", WPDebug.logFuel.ToString());
            config.SetValue("logLimits", WPDebug.logLimits.ToString());
            config.SetValue("logEvents", WPDebug.logEvents.ToString());

            config.save();
        }
Пример #20
0
        private void Serialize(bool write)
        {
            var props = from p in this.GetType().GetProperties()
                        let attr = p.GetCustomAttributes(typeof(Persistent), true)
                                   where attr.Length == 1
                                   select new { Property = p, Attribute = attr.First() as Persistent };

            foreach (var prop in props)
            {
                if (write)
                {
                    config.SetValue(prop.Property.Name, prop.Property.GetValue(this, null));
                }
                else
                {
                    prop.Property.SetValue(this, config.GetValue <object>(prop.Property.Name, prop.Attribute.DefaultValue), null);
                }
            }

            if (write)
            {
                config.save();
            }
        }
Пример #21
0
        public void SaveConfig()
        {
            KACWorker.DebugLogFormatted("Saving Config");

            KSP.IO.PluginConfiguration configfile = KSP.IO.PluginConfiguration.CreateForType <KerbalAlarmClock>();
            configfile.load();

            configfile.SetValue("DailyUpdateCheck", this.DailyVersionCheck);
            configfile.SetValue("VersionCheckDate_Attempt", this.VersionCheckDate_AttemptString);
            configfile.SetValue("VersionCheckDate_Success", this.VersionCheckDate_SuccessString);
            configfile.SetValue("VersionWeb", this.VersionWeb);

            configfile.SetValue("WindowVisible", this.WindowVisible);
            configfile.SetValue("WindowMinimized", this.WindowMinimized);
            configfile.SetValue("WindowPos", this.WindowPos);

            configfile.SetValue("WindowVisible_SpaceCenter", this.WindowVisible_SpaceCenter);
            configfile.SetValue("WindowMinimized_SpaceCenter", this.WindowMinimized_SpaceCenter);
            configfile.SetValue("WindowPos_SpaceCenter", this.WindowPos_SpaceCenter);

            configfile.SetValue("WindowVisible_TrackingStation", this.WindowVisible_TrackingStation);
            configfile.SetValue("WindowMinimized_TrackingStation", this.WindowMinimized_TrackingStation);
            configfile.SetValue("WindowPos_TrackingStation", this.WindowPos_TrackingStation);

            configfile.SetValue("IconPos", this.IconPos);
            configfile.SetValue("IconPos_SpaceCenter", this.IconPos_SpaceCenter);
            configfile.SetValue("IconShow_SpaceCenter", this.IconShow_SpaceCenter);
            configfile.SetValue("IconPos_TrackingStation", this.IconPos_TrackingStation);
            configfile.SetValue("IconShow_TrackingStation", this.IconShow_TrackingStation);

            configfile.SetValue("UseBlizzyToolbarIfAvailable", this.UseBlizzyToolbarIfAvailable);
            configfile.SetValue("WindowMinimizedType", (int)this.WindowMinimizedType);

            configfile.SetValue("UIBlockersEnabled", this.KSCUIBlockersEnabled);

            configfile.SetValue("BehaviourChecksPerSec", this.BehaviourChecksPerSec);

            configfile.SetValue("BackupSaves", this.BackupSaves);
            configfile.SetValue("BackupSavesToKeep", this.BackupSavesToKeep);
            configfile.SetValue("CancelFlightModeJumpOnBackupFailure", this.CancelFlightModeJumpOnBackupFailure);

            configfile.SetValue("AllowJumpFromViewOnly", this.AllowJumpFromViewOnly);
            configfile.SetValue("AllowJumpToAsteroid", this.AllowJumpToAsteroid);

            configfile.SetValue("AlarmListMaxAlarms", this.AlarmListMaxAlarms);
            configfile.SetValue("AlarmPosition", this.AlarmPosition);
            configfile.SetValue("AlarmDefaultAction", this.AlarmDefaultAction);
            configfile.SetValue("AlarmDefaultMargin", this.AlarmDefaultMargin);
            configfile.SetValue("AlarmDeleteOnClose", this.AlarmDeleteOnClose);
            configfile.SetValue("ShowTooltips", this.ShowTooltips);
            configfile.SetValue("ShowEarthTime", this.ShowEarthTime);
            configfile.SetValue("HideOnPause", this.HideOnPause);
            configfile.SetValue("TimeFormat", Enum.GetName(typeof(KACTime.PrintTimeFormat), this.TimeFormat));

            configfile.SetValue("AlarmXferRecalc", this.AlarmXferRecalc);
            configfile.SetValue("AlarmXferRecalcThreshold", this.AlarmXferRecalcThreshold);
            configfile.SetValue("AlarmXferDisplayList", this.AlarmXferDisplayList);
            configfile.SetValue("XferUseModelData", this.XferUseModelData);

            configfile.SetValue("AlarmNodeRecalc", this.AlarmNodeRecalc);
            configfile.SetValue("AlarmNodeRecalcThreshold", this.AlarmNodeRecalcThreshold);

            configfile.SetValue("AlarmAddSOIAuto", this.AlarmAddSOIAuto);
            configfile.SetValue("AlarmAddSOIAutoThreshold", this.AlarmAddSOIAutoThreshold);
            //configfile.SetValue("AlarmAddSOIMargin", this.AlarmAddSOIMargin);
            configfile.SetValue("AlarmAutoSOIMargin", this.AlarmAutoSOIMargin);
            configfile.SetValue("AlarmAddSOIAuto_ExcludeEVA", this.AlarmAddSOIAuto_ExcludeEVA);
            configfile.SetValue("AlarmOnSOIChange", this.AlarmCatchSOIChange);
            configfile.SetValue("AlarmOnSOIChange_Action", this.AlarmOnSOIChange_Action);

            configfile.SetValue("AlarmSOIRecalc", this.AlarmSOIRecalc);
            configfile.SetValue("AlarmSOIRecalcThreshold", this.AlarmSOIRecalcThreshold);

            configfile.SetValue("AlarmAddManAuto", this.AlarmAddManAuto);
            configfile.SetValue("AlarmAddManAuto_andRemove", this.AlarmAddManAuto_andRemove);
            configfile.SetValue("AlarmAddManAutoThreshold", this.AlarmAddManAutoThreshold);
            configfile.SetValue("AlarmAddManAutoMargin", this.AlarmAddManAutoMargin);
            configfile.SetValue("AddManAutoMargin", this.AlarmAddManAutoMargin.ToString());
            configfile.SetValue("AlarmAddManAuto_Action", this.AlarmAddManAuto_Action);

            configfile.SetValue("AlarmCrewDefaultStoreNode", this.AlarmCrewDefaultStoreNode);

            configfile.save();
            KACWorker.DebugLogFormatted("Saved Config");
        }
Пример #22
0
        public void Load()
        {
            try
            {
                KACWorker.DebugLogFormatted("Loading Config");
                KSP.IO.PluginConfiguration configfile = KSP.IO.PluginConfiguration.CreateForType <KerbalAlarmClock>();
                configfile.load();

                this.DailyVersionCheck = configfile.GetValue("DailyUpdateCheck", true);

                try { this.VersionCheckDate_Attempt = DateTime.ParseExact(configfile.GetValue("VersionCheckDate_Attempt", ""), "yyyy-MM-dd", CultureInfo.CurrentCulture); }
                catch (Exception) { this.VersionCheckDate_Attempt = new DateTime(); }

                try { this.VersionCheckDate_Success = DateTime.ParseExact(configfile.GetValue("VersionCheckDate_Success", ""), "yyyy-MM-dd", CultureInfo.CurrentCulture); }
                catch (Exception) { this.VersionCheckDate_Success = new DateTime(); }

                this.VersionWeb = configfile.GetValue("VersionWeb", "");

                this.WindowVisible   = configfile.GetValue("WindowVisible", false);
                this.WindowMinimized = configfile.GetValue("WindowMinimized", false);
                this.WindowPos       = configfile.GetValue <Rect>("WindowPos", new Rect(3, 55, 300, 45));

                this.WindowVisible_SpaceCenter   = configfile.GetValue("WindowVisible_SpaceCenter", false);
                this.WindowMinimized_SpaceCenter = configfile.GetValue("WindowMinimized_SpaceCenter", false);
                this.WindowPos_SpaceCenter       = configfile.GetValue <Rect>("WindowPos_SpaceCenter", new Rect(3, 36, 300, 45));

                this.WindowVisible_TrackingStation   = configfile.GetValue("WindowVisible_TrackingStation", false);
                this.WindowMinimized_TrackingStation = configfile.GetValue("WindowMinimized_TrackingStation", false);
                this.WindowPos_TrackingStation       = configfile.GetValue <Rect>("WindowPos_TrackingStation", new Rect(202, 45, 300, 45));

                this.IconPos                        = configfile.GetValue <Rect>("IconPos", new Rect(152, 0, 32, 32));
                this.IconPos.height                 = 32; this.IconPos.width = 32;
                this.IconPos_SpaceCenter            = configfile.GetValue <Rect>("IconPos_SpaceCenter", new Rect(3, 3, 32, 32));
                this.IconPos_SpaceCenter.height     = 32; this.IconPos_TrackingStation.width = 32;
                this.IconPos_TrackingStation        = configfile.GetValue <Rect>("IconPos_TrackingStation", new Rect(196, 0, 32, 32));
                this.IconPos_TrackingStation.height = 32; this.IconPos_TrackingStation.width = 32;

                this.IconShow_SpaceCenter     = configfile.GetValue("IconShow_SpaceCenter", true);
                this.IconShow_TrackingStation = configfile.GetValue("IconShow_TrackingStation", true);

                this.UseBlizzyToolbarIfAvailable = configfile.GetValue <Boolean>("UseBlizzyToolbarIfAvailable", true);
                this.WindowMinimizedType         = (MiminalDisplayType)configfile.GetValue("WindowMinimizedType", 0);

                this.KSCUIBlockersEnabled = configfile.GetValue <Boolean>("UIBlockersEnabled", true);

                this.BehaviourChecksPerSec        = configfile.GetValue("BehaviourChecksPerSec", 10);
                this.BehaviourChecksPerSec_Custom = configfile.GetValue("BehaviourChecksPerSecCustom", 40);

                this.BackupSaves       = configfile.GetValue("BackupSaves", true);
                this.BackupSavesToKeep = configfile.GetValue("BackupSavesToKeep", 20);
                this.CancelFlightModeJumpOnBackupFailure = configfile.GetValue("CancelFlightModeJumpOnBackupFailure", false);

                this.AllowJumpFromViewOnly = configfile.GetValue("AllowJumpFromViewOnly", true);
                this.AllowJumpToAsteroid   = configfile.GetValue("AllowJumpToAsteroid", false);

                this.AlarmListMaxAlarms = configfile.GetValue("AlarmListMaxAlarms", "10");
                this.AlarmDefaultAction = configfile.GetValue <int>("AlarmDefaultAction", 1);
                this.AlarmDefaultMargin = configfile.GetValue <Double>("AlarmDefaultMargin", 60);
                this.AlarmPosition      = configfile.GetValue <int>("AlarmPosition", 1);
                this.AlarmDeleteOnClose = configfile.GetValue("AlarmDeleteOnClose", false);
                this.ShowTooltips       = configfile.GetValue("ShowTooltips", true);
                this.ShowEarthTime      = configfile.GetValue("ShowEarthTime", false);
                this.HideOnPause        = configfile.GetValue("HideOnPause", true);
                String strTimeFormat = configfile.GetValue("TimeFormat", "KSPString");
                //KACWorker.DebugLogFormatted("{0}",strTimeFormat);
                this.TimeFormat = (KACTime.PrintTimeFormat)Enum.Parse(typeof(KACTime.PrintTimeFormat), strTimeFormat);
                //this.TimeFormat = configfile.GetValue<KACTime.PrintTimeFormat>("TimeFormat", KACTime.PrintTimeFormat.KSPString);
                //KACWorker.DebugLogFormatted("{0}",this.TimeFormat.ToString());
                if (configfile.GetValue <bool>("TimeAsUT", false) == true)
                {
                    KACWorker.DebugLogFormatted("Forcing New Format");
                    this.TimeFormat = KACTime.PrintTimeFormat.TimeAsUT;
                    configfile.SetValue("TimeAsUT", false);
                    configfile.SetValue("TimeFormat", Enum.GetName(typeof(KACTime.PrintTimeFormat), this.TimeFormat));
                    configfile.save();
                }

                this.AlarmXferRecalc          = configfile.GetValue("AlarmXferRecalc", true);
                this.AlarmXferRecalcThreshold = configfile.GetValue <Double>("AlarmXferRecalcThreshold", 180);
                this.AlarmXferDisplayList     = configfile.GetValue("AlarmXferDisplayList", false);
                this.XferUseModelData         = configfile.GetValue("XferUseModelData", false);

                this.AlarmNodeRecalc          = configfile.GetValue("AlarmNodeRecalc", false);
                this.AlarmNodeRecalcThreshold = configfile.GetValue <Double>("AlarmNodeRecalcThreshold", 180);

                this.AlarmAddSOIAuto          = configfile.GetValue("AlarmAddSOIAuto", false);
                this.AlarmAddSOIAutoThreshold = configfile.GetValue <Double>("AlarmAddSOIAutoThreshold", 180);
                //this.AlarmAddSOIMargin = configfile.GetValue("AlarmAddSOIMargin", 120);
                this.AlarmAutoSOIMargin         = configfile.GetValue <Double>("AlarmAutoSOIMargin", 900);
                this.AlarmAddSOIAuto_ExcludeEVA = configfile.GetValue("AlarmAddSOIAuto_ExcludeEVA", true);
                this.AlarmCatchSOIChange        = configfile.GetValue("AlarmOnSOIChange", false);
                this.AlarmOnSOIChange_Action    = configfile.GetValue("AlarmOnSOIChange_Action", 1);

                this.AlarmSOIRecalc          = configfile.GetValue("AlarmSOIRecalc", false);
                this.AlarmSOIRecalcThreshold = configfile.GetValue <Double>("AlarmSOIRecalcThreshold", 180);

                this.AlarmAddManAuto           = configfile.GetValue("AlarmAddManAuto", false);
                this.AlarmAddManAuto_andRemove = configfile.GetValue("AlarmAddManAuto_andRemove", false);
                this.AlarmAddManAutoThreshold  = configfile.GetValue <Double>("AlarmAddManAutoThreshold", 180);
                this.AlarmAddManAutoMargin     = configfile.GetValue <Double>("AlarmAddManAutoMargin", 180);
                this.AlarmAddManAuto_Action    = configfile.GetValue("AlarmAddManAuto_Action", 1);

                this.AlarmCrewDefaultStoreNode = configfile.GetValue("AlarmCrewDefaultStoreNode", false);

                this.LoadManNode      = configfile.GetValue("LoadManNode", "");
                this.LoadVesselTarget = configfile.GetValue("LoadVesselTarget", "");

                if (KSP.IO.File.Exists <KerbalAlarmClock>(String.Format("Alarms-{0}.txt", HighLogic.CurrentGame.Title)))
                {
                    KACWorker.DebugLogFormatted("Trying New Alarms file...");
                    LoadAlarms();
                }
                else
                {
                    //Loop through numbers to Load Alarms
                    Alarms = new KACAlarmList();
                    int    intAlarm = 0;
                    String strAlarm = "";
                    do
                    {
                        strAlarm = configfile.GetValue("Alarm_" + intAlarm, "");
                        KACWorker.DebugLogFormatted(strAlarm);
                        if (strAlarm != "")
                        {
                            KACAlarm tmpAlarm = new KACAlarm();
                            tmpAlarm.LoadFromString(strAlarm);
                            Alarms.Add(tmpAlarm);
                            intAlarm++;
                        }
                    } while (strAlarm != "");
                }
                KACWorker.DebugLogFormatted("Config Loaded Successfully");
            }

            catch (Exception ex)
            {
                KACWorker.DebugLogFormatted("Failed To Load Config");
                KACWorker.DebugLogFormatted(ex.Message);
            }
        }
Пример #23
0
 void OnDisable()
 {
     configFile.save();
 }
Пример #24
0
 virtual public void SaveSettings()
 {
     configfile.SetValue(mangleName("gui_enabled"), gui_enabled);
     configfile.save();
 }