Exemplo n.º 1
0
        private void CheckConfigure()
        {
            bool isModified = false;
            Dictionary <string, string> displayOptions = new Dictionary <string, string>();
            ConfigOptionMap             options        = GameManager.Instance.root.GetRenderSystemByName(renderMenu.getSelectedItem()).GetConfigOptions();

            for (uint i = 3; i < GameManager.Instance.trayMgr.getNumWidgets(renderMenu.getTrayLocation()); i++)
            {
                SelectMenu optionMenu = (SelectMenu)GameManager.Instance.trayMgr.getWidget(renderMenu.getTrayLocation(), i);
                if (optionMenu.getSelectedItem() != options[optionMenu.getCaption()].currentValue)
                {
                    isModified = true;
                }
                displayOptions.Add(optionMenu.getCaption(), optionMenu.getSelectedItem());
            }
            OgreConfigFileAdapter       ofa         = new OgreConfigFileAdapter("ogre.cfg");
            List <OgreConfigNode>       ogrecfgdata = ofa.ReadConfigData();
            OgreConfigNode              oneConfig   = ogrecfgdata.Where(o => o.Section == renderMenu.getSelectedItem()).FirstOrDefault();
            Dictionary <string, string> fileOptions = oneConfig.Settings;

            if (isModified)
            {
                int indexDeleted = ogrecfgdata.IndexOf(oneConfig);
                ogrecfgdata.RemoveAt(indexDeleted);
                oneConfig.Settings = displayOptions;
                ogrecfgdata.Insert(indexDeleted, oneConfig);
                ofa.SaveConfig(ogrecfgdata);
                m_bQuit = true;

                ReConfigure(renderMenu.getSelectedItem(), displayOptions);
            }
        }