public void UpdateTechTree() { ConfigNode new_tech_nodes = PluginHelper.getNewTechTreeFile(); if (new_tech_nodes != null) { new_tech_nodes.Save(PluginHelper.getTechTreeFilePath()); PopupDialog.SpawnPopupDialog("Restart KSP", "Changes to the tech tree have been applied, please restart KSP before continuing.", "OK", false, GUI.skin); } }
public void Start() { tech_window = new TechUpdateWindow(); tech_checked = false; if (!tech_checked) { ConfigNode tech_nodes = PluginHelper.getTechTreeFile(); ConfigNode new_tech_nodes = PluginHelper.getNewTechTreeFile(); if (tech_nodes != null) { if (tech_nodes.HasNode("VERSION")) { ConfigNode version_node = tech_nodes.GetNode("VERSION"); if (version_node.HasValue("id")) { installed_tech_tree_version_id = Convert.ToInt32(version_node.GetValue("id")); } } } if (new_tech_nodes != null) { if (new_tech_nodes.HasNode("VERSION")) { ConfigNode version_node2 = new_tech_nodes.GetNode("VERSION"); if (version_node2.HasValue("id")) { new_tech_tree_version_id = Convert.ToInt32(version_node2.GetValue("id")); } } } if (new_tech_tree_version_id > installed_tech_tree_version_id) { tech_window.Show(); tech_window.UpdateTechTree(); } tech_checked = true; } }