Esempio n. 1
0
 private void gameSceneChanged(ToolbarGameScene scene)
 {
     if (isRelevantGameScene(scene))
     {
         loadSettings(scene);
     }
 }
Esempio n. 2
0
        private void loadSettings(ToolbarGameScene scene)
        {
            Log.info("loading settings (game scene: {0})", scene);

            foreach (Toolbar toolbar in toolbars.Values)
            {
                toolbar.destroy();
            }
            toolbars.Clear();

            WindowList.Instance.destroyDialogs();

            bool checkForUpdates = true;

            ConfigNode root = loadSettings();

            if (root.HasNode("toolbars"))
            {
                ConfigNode toolbarsNode = root.GetNode("toolbars");
                Log.Level = (LogLevel)int.Parse(toolbarsNode.get("logLevel", ((int)
#if DEBUG
                                                                              LogLevel.INFO
#else
                                                                              LogLevel.WARN
#endif
                                                                              ).ToString()));
                checkForUpdates = toolbarsNode.get("checkForUpdates", true);

                string[] kspVersions = toolbarsNode.get("kspVersions", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (kspVersions.Length > 0)
                {
                    UpdateChecker.KspVersions           = kspVersions;
                    UpdateChecker.KspVersionsFromConfig = true;
                }

                if (toolbarsNode.HasNode(scene.ToString()))
                {
                    ConfigNode sceneNode = toolbarsNode.GetNode(scene.ToString());
                    foreach (ConfigNode toolbarNode in sceneNode.nodes)
                    {
                        Toolbar toolbar = addToolbar(toolbarNode.name);
                        toolbar.loadSettings(toolbarNode);
                    }
                }
            }

            // ensure there is at least one toolbar in the scene
            if (ToolbarsCount == 0)
            {
                Log.info("no toolbars in current game scene, adding default toolbar");
                addToolbar();
            }

            Log.info("update check {0}", checkForUpdates ? "enabled" : "disabled");
            UpdateChecker.CheckForUpdates = checkForUpdates;
        }
Esempio n. 3
0
        private void handleGameSceneChange()
        {
            ToolbarGameScene scene = ToolbarGameScenes.getCurrent();

            if (scene != gameScene)
            {
                gameScene = scene;
                gameSceneChanged(scene);
            }
        }
        private void saveSettings(ToolbarGameScene scene)
        {
            Log.info("saving settings (game scene: {0})", scene);

            ConfigNode toolbarsNode = settings.Node;

            ConfigNode sceneNode = toolbarsNode.getOrCreateNode(scene.ToString());

            foreach (KeyValuePair <string, Toolbar> entry in toolbars)
            {
                ConfigNode toolbarNode = sceneNode.getOrCreateNode(entry.Key);
                entry.Value.saveSettings(toolbarNode);
            }
            settings.Save();
        }
Esempio n. 5
0
        private void saveSettings(ToolbarGameScene scene)
        {
            Log.info("saving settings (game scene: {0})", scene);

            ConfigNode root         = loadSettings();
            ConfigNode toolbarsNode = root.getOrCreateNode("toolbars");
            ConfigNode sceneNode    = toolbarsNode.getOrCreateNode(scene.ToString());

            foreach (KeyValuePair <string, Toolbar> entry in toolbars)
            {
                ConfigNode toolbarNode = sceneNode.getOrCreateNode(entry.Key);
                entry.Value.saveSettings(toolbarNode);
            }
            root.Save(SETTINGS_FILE);
        }
Esempio n. 6
0
        private void loadSettings(ToolbarGameScene scene)
        {
            Log.info("loading settings (game scene: {0})", scene);

            foreach (Toolbar toolbar in toolbars.Values)
            {
                toolbar.destroy();
            }
            toolbars.Clear();

            WindowList.Instance.destroyDialogs();

            bool checkForUpdates = true;

            ConfigNode root = loadSettings();

            if (root.HasNode("toolbars"))
            {
                ConfigNode toolbarsNode = root.GetNode("toolbars");
                Log.Level = (LogLevel)int.Parse(toolbarsNode.get("logLevel", ((int)
#if DEBUG
                                                                              LogLevel.INFO
#else
                                                                              LogLevel.WARN
#endif
                                                                              ).ToString()));
                checkForUpdates = toolbarsNode.get("checkForUpdates", true);

                if (toolbarsNode.HasNode(scene.ToString()))
                {
                    ConfigNode sceneNode = toolbarsNode.GetNode(scene.ToString());
                    foreach (ConfigNode toolbarNode in sceneNode.nodes)
                    {
                        Toolbar toolbar = addToolbar(toolbarNode.name);
                        toolbar.loadSettings(toolbarNode);
                    }
                }
            }

            // ensure there is at least one toolbar in the scene
            if (ToolbarsCount == 0)
            {
                Log.info("no toolbars in current game scene, adding default toolbar");
                addToolbar();
            }
        }
Esempio n. 7
0
        private void saveSettings(ToolbarGameScene scene)
        {
            Log.info("saving settings (game scene: {0})", scene);

            ConfigNode root         = loadSettings();
            ConfigNode toolbarsNode = root.getOrCreateNode("toolbars");

            if (UpdateChecker.Done &&
                (UpdateChecker.KspVersions != null) &&
                (UpdateChecker.KspVersions.Length > 0))
            {
                toolbarsNode.overwrite("kspVersions", string.Join(",", UpdateChecker.KspVersions));
            }

            ConfigNode sceneNode = toolbarsNode.getOrCreateNode(scene.ToString());

            foreach (KeyValuePair <string, Toolbar> entry in toolbars)
            {
                ConfigNode toolbarNode = sceneNode.getOrCreateNode(entry.Key);
                entry.Value.saveSettings(toolbarNode);
            }
            root.Save(SETTINGS_FILE);
        }
Esempio n. 8
0
        private void saveSettings(ToolbarGameScene scene)
        {
            Log.info("saving settings (game scene: {0})", scene);

            ConfigNode root = loadSettings();
            ConfigNode toolbarsNode = root.getOrCreateNode("toolbars");

            if (UpdateChecker.Done &&
                (UpdateChecker.KspVersions != null) &&
                (UpdateChecker.KspVersions.Length > 0)) {

                toolbarsNode.overwrite("kspVersions", string.Join(",", UpdateChecker.KspVersions));
            }

            ConfigNode sceneNode = toolbarsNode.getOrCreateNode(scene.ToString());
            foreach (KeyValuePair<string, Toolbar> entry in toolbars) {
                ConfigNode toolbarNode = sceneNode.getOrCreateNode(entry.Key);
                entry.Value.saveSettings(toolbarNode);
            }
            root.Save(SETTINGS_FILE);
        }
Esempio n. 9
0
        private void loadSettings(ToolbarGameScene scene)
        {
            Log.info("loading settings (game scene: {0})", scene);

            foreach (Toolbar toolbar in toolbars.Values) {
                toolbar.destroy();
            }
            toolbars.Clear();

            WindowList.Instance.destroyDialogs();

            bool checkForUpdates = true;

            ConfigNode root = loadSettings();
            if (root.HasNode("toolbars")) {
                ConfigNode toolbarsNode = root.GetNode("toolbars");
                Log.Level = (LogLevel) int.Parse(toolbarsNode.get("logLevel", ((int)
            #if DEBUG
                        LogLevel.INFO
            #else
                        LogLevel.WARN
            #endif
                    ).ToString()));
                checkForUpdates = toolbarsNode.get("checkForUpdates", true);

                string[] kspVersions = toolbarsNode.get("kspVersions", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (kspVersions.Length > 0) {
                    UpdateChecker.KspVersions = kspVersions;
                    UpdateChecker.KspVersionsFromConfig = true;
                }

                if (toolbarsNode.HasNode(scene.ToString())) {
                    ConfigNode sceneNode = toolbarsNode.GetNode(scene.ToString());
                    foreach (ConfigNode toolbarNode in sceneNode.nodes) {
                        Toolbar toolbar = addToolbar(toolbarNode.name);
                        toolbar.loadSettings(toolbarNode);
                    }
                }
            }

            // ensure there is at least one toolbar in the scene
            if (ToolbarsCount == 0) {
                Log.info("no toolbars in current game scene, adding default toolbar");
                addToolbar();
            }

            Log.info("update check {0}", checkForUpdates ? "enabled" : "disabled");
            UpdateChecker.CheckForUpdates = checkForUpdates;
        }
Esempio n. 10
0
 private bool isRelevantGameScene(ToolbarGameScene scene)
 {
     return (scene != ToolbarGameScene.LOADING) && (scene != ToolbarGameScene.LOADINGBUFFER) &&
         (scene != ToolbarGameScene.MAINMENU) && (scene != ToolbarGameScene.PSYSTEM) && (scene != ToolbarGameScene.CREDITS);
 }
Esempio n. 11
0
 private void handleGameSceneChange()
 {
     ToolbarGameScene scene = ToolbarGameScenes.getCurrent();
     if (scene != gameScene) {
         gameScene = scene;
         gameSceneChanged(scene);
     }
 }
Esempio n. 12
0
 private void gameSceneChanged(ToolbarGameScene scene)
 {
     if (isRelevantGameScene(scene)) {
         loadSettings(scene);
     }
 }
Esempio n. 13
0
 private bool isRelevantGameScene(ToolbarGameScene scene)
 {
     return((scene != ToolbarGameScene.LOADING) && (scene != ToolbarGameScene.LOADINGBUFFER) &&
            (scene != ToolbarGameScene.MAINMENU) && (scene != ToolbarGameScene.PSYSTEM) && (scene != ToolbarGameScene.CREDITS));
 }
Esempio n. 14
0
        private void saveSettings(ToolbarGameScene scene)
        {
            Log.info("saving settings (game scene: {0})", scene);

            ConfigNode root = loadSettings();
            ConfigNode toolbarsNode = root.getOrCreateNode("toolbars");
            ConfigNode sceneNode = toolbarsNode.getOrCreateNode(scene.ToString());
            foreach (KeyValuePair<string, Toolbar> entry in toolbars) {
                ConfigNode toolbarNode = sceneNode.getOrCreateNode(entry.Key);
                entry.Value.saveSettings(toolbarNode);
            }
            root.Save(SETTINGS_FILE);
        }
Esempio n. 15
0
        private void loadSettings(ToolbarGameScene scene)
        {
            Log.info("loading settings (game scene: {0})", scene);

            foreach (Toolbar toolbar in toolbars.Values) {
                toolbar.destroy();
            }
            toolbars.Clear();

            WindowList.Instance.destroyDialogs();

            bool checkForUpdates = true;

            ConfigNode root = loadSettings();
            if (root.HasNode("toolbars")) {
                ConfigNode toolbarsNode = root.GetNode("toolbars");
                Log.Level = (LogLevel) int.Parse(toolbarsNode.get("logLevel", ((int) LogLevel.WARN).ToString()));
                checkForUpdates = toolbarsNode.get("checkForUpdates", true);

                if (toolbarsNode.HasNode(scene.ToString())) {
                    ConfigNode sceneNode = toolbarsNode.GetNode(scene.ToString());
                    foreach (ConfigNode toolbarNode in sceneNode.nodes) {
                        Toolbar toolbar = addToolbar(toolbarNode.name);
                        toolbar.loadSettings(toolbarNode);
                    }
                }
            }

            // ensure there is at least one toolbar in the scene
            if (ToolbarsCount == 0) {
                Log.info("no toolbars in current game scene, adding default toolbar");
                addToolbar();
            }

            if (updateChecker != null) {
                Log.info("update check {0}", checkForUpdates ? "enabled" : "disabled");
                updateChecker.CheckForUpdates = checkForUpdates;
            }
        }