Example #1
0
        internal void saveSettings(ConfigNode parentNode, GameScenes scene)
        {
            ConfigNode toolbarNode = parentNode.getOrCreateNode("toolbar");
            ConfigNode settingsNode = toolbarNode.getOrCreateNode(scene.ToString());
            settingsNode.overwrite("x", rect.x.ToString("F0"));
            settingsNode.overwrite("y", rect.y.ToString("F0"));
            settingsNode.overwrite("width", savedMaxWidth.ToString("F0"));
            settingsNode.overwrite("height", rect.height.ToString("F0"));
            settingsNode.overwrite("autoHide", autoHide.ToString());
            settingsNode.overwrite("drawBorder", showBorder.ToString());
            settingsNode.overwrite("useKSPSkin", UseKSPSkin.ToString());
            settingsNode.overwrite("buttonOrder", string.Join(",", savedButtonOrder.ToArray()));
            settingsNode.overwrite("visibleButtons", string.Join(",", savedVisibleButtons.ToArray()));

            ConfigNode foldersNode = settingsNode.overwriteNode("folders");
            foreach (KeyValuePair<string, FolderSettings> entry in savedFolderSettings) {
                ConfigNode folderNode = foldersNode.getOrCreateNode(entry.Key);
                folderNode.overwrite("toolTip", entry.Value.toolTip ?? "");
                folderNode.overwrite("buttons", string.Join(",", entry.Value.buttons.ToArray()));
            }
            if (foldersNode.CountNodes == 0) {
                settingsNode.RemoveNode("folders");
            }
        }