Пример #1
0
        /// <summary>
        /// Saves settings to config file
        /// </summary>
        private void saveSettings()
        {
            BinMasterSettings settings = new BinMasterSettings();

            //Tab page 1
            settings.objectModel         = saveComboBox(cbObjModel);
            settings.convTo3ds           = rdo3dsConv.Checked;
            settings.convToE             = rdoEConv.Checked;
            settings.noTextureConv       = chkNoTextures.Checked;
            settings.gameDir             = saveComboBox(cbGameDir);
            settings.resPackFile         = saveComboBox(cbResMod);
            settings.noResPack           = chkNoResMods.Checked;
            settings.convObjDir          = saveComboBox(cbConvObjDir);
            settings.convTexDir          = saveComboBox(cbConvTexDir);
            settings.convTexDirSameAsObj = chkConvTexInObjDir.Checked;
            //Tab page 2
            settings.binToEPath             = saveComboBox(cbBintoE);
            settings.eto3dsPath             = saveComboBox(cbEto3ds);
            settings.texConvProgPath        = saveComboBox(cbTexConvProg);
            settings.texConvCommandTemplate = saveComboBox(cbTexConvCmd);
            settings.texFormatID            = cbTexFormat.SelectedIndex;
            //Tab page 3
            settings.autoSetResourceDir = chkAutoSetResourceDir.Checked;
            settings.altResourceDir     = saveComboBox(cbResDir);

            string saveSettings = JsonConvert.SerializeObject(settings, Formatting.Indented);

            File.WriteAllText(configFile, saveSettings);
        }
Пример #2
0
        /// <summary>
        /// Reads the config file and polulates controls
        /// </summary>
        private void loadSettings()
        {
            if (File.Exists(configFile))
            {
                string            strSettings = File.ReadAllText(configFile);
                BinMasterSettings settings    = JsonConvert.DeserializeObject <BinMasterSettings>(strSettings);
                //Tab page 1
                cbObjModel.Items.AddRange(settings.objectModel);
                rdo3dsConv.Checked    = settings.convTo3ds;
                rdoEConv.Checked      = settings.convToE;
                chkNoTextures.Checked = settings.noTextureConv;
                cbGameDir.Items.AddRange(settings.gameDir);
                cbResMod.Items.AddRange(settings.resPackFile);
                chkNoResMods.Checked = settings.noResPack;
                cbConvObjDir.Items.AddRange(settings.convObjDir);
                cbConvTexDir.Items.AddRange(settings.convTexDir);
                chkConvTexInObjDir.Checked = settings.convTexDirSameAsObj;
                //Tab page 2
                cbBintoE.Items.AddRange(settings.binToEPath);
                cbEto3ds.Items.AddRange(settings.eto3dsPath);
                cbTexConvProg.Items.AddRange(settings.texConvProgPath);
                cbTexConvCmd.Items.AddRange(settings.texConvCommandTemplate);
                cbTexFormat.SelectedIndex = settings.texFormatID;
                //Tab page 3
                chkAutoSetResourceDir.Checked = settings.autoSetResourceDir;
                cbResDir.Items.AddRange(settings.altResourceDir);

                //Fill combo boxes
                selectComboItem0(cbGameDir);
                selectComboItem0(cbResMod);
                selectComboItem0(cbBintoE);
                selectComboItem0(cbEto3ds);
                selectComboItem0(cbTexConvProg);
                selectComboItem0(cbTexConvCmd);
                selectComboItem0(cbResDir);
                allowSetResFolder = true;
            }
        }