public void SaveConfiguration(string configName) { Log.Info("SaveConfiguration"); ConfigNode cfgNode = new ConfigNode(); if (configName [0] == '*') { configName = configName.Substring(2); } configName = configName.Replace(' ', '_'); if (File.Exists(KRASH_CUSTOM_CFG_FILE)) { configFile = ConfigNode.Load(KRASH_CUSTOM_CFG_FILE); } else { configFile = null; } if (configFile != null) { configFileNode = configFile.GetNode(KRASH_CUSTOM_NODE); if (configFileNode != null) { cfgNode.SetValue("flatSetupCost", flatSetupCost.ToString(), true); cfgNode.SetValue("flatPerMinCost", flatPerMinCost.ToString(), true); cfgNode.SetValue("perPartSetupCost", perPartSetupCost.ToString(), true); cfgNode.SetValue("perPartPerMinCost", perPartPerMinCost.ToString(), true); cfgNode.SetValue("perTonSetupCost", perTonSetupCost.ToString(), true); cfgNode.SetValue("perTonPerMinCost", perTonPerMinCost.ToString(), true); cfgNode.SetValue("percentSetupCost", (100 * percentSetupCost).ToString(), true); cfgNode.SetValue("percentPerMinCost", (100 * percentPerMinCost).ToString(), true); cfgNode.SetValue("AtmoMultipler", AtmoMultipler.ToString(), true); cfgNode.SetValue("TerminateAtSoiWithoutData", TerminateAtSoiWithoutData.ToString(), true); cfgNode.SetValue("TerminateAtLandWithoutData", TerminateAtLandWithoutData.ToString(), true); cfgNode.SetValue("TerminateAtAtmoWithoutData", TerminateAtAtmoWithoutData.ToString(), true); cfgNode.SetValue("ContinueIfNoCash", ContinueIfNoCash.ToString(), true); cfgNode.SetValue("ObeyPadLimits", ObeyPadLimits.ToString(), true); cfgNode.SetValue("DefaultMaxAllowableSimCost", DefaultMaxAllowableSimCost.ToString(), true); cfgNode.SetValue("DefaultSimTime", DefaultSimTime.ToString(), true); } //configFileNode.SetValue ("selectedCosts", selectedCosts.ToString (), true); configFileNode.SetValue("showRunningSimCosts", showRunningSimCosts.ToString(), true); configFileNode.SetValue("showAllInCareer", showAllInCareer.ToString(), true); configFileNode.SetValue("horizontalPos", horizontalPos.ToString(), true); configFileNode.SetValue("verticalPos", verticalPos.ToString(), true); configFileNode.RemoveNode(configName); configFileNode.AddNode(configName, cfgNode); configFile.Save(KRASH_CUSTOM_CFG_FILE); } saveDisplayValues(); }
private void LogConfiguration(string node) { Log.Info("Config node: " + node); Log.Info("flatSetupCost: " + flatSetupCost.ToString()); Log.Info("flatPerMinCost: " + flatPerMinCost.ToString()); Log.Info("perPartSetupCost: " + perPartSetupCost.ToString()); Log.Info("perPartPerMinCost: " + perPartPerMinCost.ToString()); Log.Info("perTonSetupCost: " + perTonSetupCost.ToString()); Log.Info("perTonPerMinCost: " + perTonPerMinCost.ToString()); Log.Info("AtmoPerMinMultipler: " + AtmoMultipler.ToString()); Log.Info("TerminateAtLandWithoutData: " + TerminateAtLandWithoutData.ToString()); Log.Info("TerminateAtSoiWithoutData: " + TerminateAtSoiWithoutData.ToString()); Log.Info("TerminateAtAtmoWithoutData: " + TerminateAtAtmoWithoutData.ToString()); Log.Info("ContinueIfNoCash: " + ContinueIfNoCash.ToString()); Log.Info("ObeyPadLimits: " + ObeyPadLimits.ToString()); Log.Info("MaxAllowableSimCost: " + MaxAllowableSimCost.ToString()); Log.Info("DefaultSimTime: " + DefaultSimTime.ToString()); }