예제 #1
0
        internal void saveSettings(ConfigNode toolbarNode)
        {
            Log.info("saving toolbar settings (toolbar '{0}')", toolbarNode.name);

            toolbarNode.overwrite("x", rect.x.ToString("F0"));
            toolbarNode.overwrite("y", rect.y.ToString("F0"));
            toolbarNode.overwrite("width", savedMaxWidth.ToString("F0"));
            toolbarNode.overwrite("height", rect.height.ToString("F0"));
            toolbarNode.overwrite("autoHide", autoHide.ToString());
            toolbarNode.overwrite("drawBorder", showBorder.ToString());
            toolbarNode.overwrite("useKSPSkin", UseKSPSkin.ToString());
            toolbarNode.overwrite("buttonOrder", string.Join(",", savedButtonOrder.ToArray()));
            toolbarNode.overwrite("visibleButtons", string.Join(",", savedVisibleButtons.ToArray()));

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