Example #1
0
 // saving settings after land texture creation
 private void SaveTexSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniTexTab, true);
     iniFile.setKey("TexRes", cmbTexWorldResolution.SelectedIndex);
     iniFile.setKey("NormRes", cmbTexWorldNormalRes.SelectedIndex);
     iniFile.setKey("Tex2Step", cbTexTwoStep.Checked);
     iniFile.save();
 }
Example #2
0
 /* Configuration methods */
 
 // loading all settings
 private void LoadSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniDLWizardVars, true);
     configure = !iniFile.hasSection(iniDLWizardSets);
     if (configure) {
         iniFile.initialize();
         iniFile.save();
     }
     pluginDirs = new List<string>(iniFile.getSectList(iniDLWizardPlugDirs));
     pluginDirs.Sort();
     string dir2 = "";
     foreach (string s in pluginDirs) {
         string dir1 = s.ToLower(Statics.Culture);
         if (dir1 == dir2) pluginDirs.Remove(s);
         dir2 = dir1;
     }
     pluginList = new MWPlugins(Statics.fn_datafiles, pluginDirs);
     switch ((int)iniFile.getKeyValue("PlugSort")) {
         case 0: rbPlugsName.Checked = true; break;
         case 1: rbPlugsType.Checked = true; break;
         case 2: rbPlugsLoad.Checked = true; break;
     }
     pluginsSort(null, null);
     preselectedPlugins = iniFile.getSectList(iniDLWizardPlugs);
     SelectPlugins(preselectedPlugins);
     cmbTexWorldResolution.SelectedIndex = (int)iniFile.getKeyValue("TexRes");
     cmbTexWorldNormalRes.SelectedIndex = (int)iniFile.getKeyValue("NormRes");
     cbTexTwoStep.Checked = (iniFile.getKeyValue("Tex2Step") == 1);
     cmbMeshWorldDetail.SelectedIndex = (int)iniFile.getKeyValue("WorldMesh");
     udStatMinSize.Value = (int)iniFile.getKeyValue("MinStat");
     udStatGrassDensity.Value = (int)iniFile.getKeyValue("GrassDens");
     cmbStatSimplifyMeshes.SelectedIndex = (int)iniFile.getKeyValue("StatMesh");
     cmbStatSkipMipLevels.SelectedIndex = (int)iniFile.getKeyValue("SkipMip");
     cbStatActivators.Checked = (iniFile.getKeyValue("Activators") == 1);
     cbStatIncludeMisc.Checked = (iniFile.getKeyValue("MiscObj") == 1);
     cbStatOverrideList.Checked = (iniFile.getKeyValue("UseStatOvr") == 1);
     cbStatIntExt.Checked = (iniFile.getKeyValue("StatIntExt") == 1);
     cbStatIntWater.Checked = (iniFile.getKeyValue("StatIntWater") == 1);
     lbStatOverrideList.Items.Clear();
     lbStatOverrideList.Items.AddRange(iniFile.getSectList(iniDLWizardStatOvr));
     lStatOverrideList.Enabled = (lbStatOverrideList.Items.Count == 0);
 }
Example #3
0
 // saving settings after plugin selection
 private void SavePlugsSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniPlugsTab, true);
     double temp;
     if (rbPlugsName.Checked) temp = 0;
     else if (rbPlugsType.Checked) temp = 1;
     else if (rbPlugsLoad.Checked) temp = 2;
     else temp = 1;
     iniFile.setKey("PlugSort", temp);
     iniFile.setSectList(iniDLWizardPlugDirs, pluginDirs.ToArray());
     List<string> tempList = new List<string>();
     foreach (string s in clbPlugsModList.CheckedItems) tempList.Add(s);
     iniFile.setSectList(iniDLWizardPlugs, tempList.ToArray());
     iniFile.save();
 }
Example #4
0
        private void bSave_Click(object sender,EventArgs e)
        {
            INIFile iniFile = new INIFile(Statics.iniFileName, iniShaderWhat, true);
            List<string> tempList = new List<string>();
            foreach (string s in lbSelected.Items) tempList.Add(s);
            iniFile.setSectOrderedList(iniShaderChain, tempList.ToArray());
            iniFile.save();

            Close();
        }
Example #5
0
 private bool SaveFile(String fileName)
 {
     try { File.Delete(fileName); } catch { return false; }
     List<INIFile.INIVariableDef> defmcp = new List<INIFile.INIVariableDef>();
     List<String[]> comments = new List<String[]>(); //  0 - section, 1 - key, 2 - comment above
     defmcp.Add(INIFile.iniDefEmpty);
     foreach (String section in selections.Sections.Keys) {
         Patch patch = selections.Sections[section];
         if (patch.Checked != new Patch().Checked)
             defmcp.Add(new INIFile.INIVariableDef(defmcp.Count.ToString(), section, Patch.Keys[Patch.Key.Checked], INIFile.INIVariableType.Dictionary, patch.Checked.ToString()));
         defmcp.Add(new INIFile.INIVariableDef(defmcp.Count.ToString(), section, Patch.Keys[Patch.Key.Version], INIFile.INIVariableType.Dictionary, patch.Version.ToString()));
         Dictionary<Patch.Key, String> str = new Dictionary<Patch.Key, String> { { Patch.Key.Parent, patch.Parent }, { Patch.Key.Author, patch.Author } };
         foreach (Patch.Key key in str.Keys) if (str[key].Trim().Length > 0)
             defmcp.Add(new INIFile.INIVariableDef(defmcp.Count.ToString(), section, Patch.Keys[key], INIFile.INIVariableType.Dictionary, str[key].Trim()));
         if (patch.FileVersion != new Patch().FileVersion)
             defmcp.Add(new INIFile.INIVariableDef(defmcp.Count.ToString(), section, Patch.Keys[Patch.Key.FileVersion], INIFile.INIVariableType.Dictionary, patch.FileVersion.ToString()));
         Dictionary<Patch.Key, Unit[]> array = new Dictionary<Patch.Key, Unit[]> { { Patch.Key.Original, patch.Original }, { Patch.Key.Patch, patch.Patched }, { Patch.Key.Attach, patch.Attach }, { Patch.Key.Description, patch.Description } };
         foreach (Patch.Key key in array.Keys) if (array[key] != null) foreach (Unit unit in array[key]) {
             String[] asm_lines = unit.Asm.Split(new Char[] { '\n' });
             String[] hex_lines = unit.Hex.Split(new Char[] { '\n' });
             String hex = "";
             int comment = 0;
             foreach (String line in hex_lines) hex += (hex.Length > 0 ? "\t" : "") + ((comment = line.IndexOf(INIFile.INIComment)) < 0 ? line : line.Substring(0, comment)).TrimEnd(null);
             if (hex.Trim().Length == 0) continue;
             String variable = Patch.Keys[key] + " " + unit.ToString();
             for (int i = 0; i < asm_lines.Length; i++) if (i == asm_lines.Length - 1 ? asm_lines[i].Trim().Length > 0 : true) comments.Add(new String[3] { section, variable, asm_lines[i] });
             defmcp.Add(new INIFile.INIVariableDef(defmcp.Count.ToString(), section, variable, INIFile.INIVariableType.Dictionary, hex));
         }
         if (patch.Removed != new Patch().Removed)
             defmcp.Add(new INIFile.INIVariableDef(defmcp.Count.ToString(), section, Patch.Keys[Patch.Key.Removed], INIFile.INIVariableType.Dictionary, patch.Removed.ToString()));
     }
     INIFile mcpFile = new INIFile(fileName, defmcp.ToArray(), Encoding.Default, true);
     mcpFile.initialize();
     foreach (String[] triplet in comments) mcpFile.setCommentAbove(triplet[0], triplet[1], triplet[2]);
     return mcpFile.save();
 }
Example #6
0
 /* Configuration methods */
 // loading all settings
 private void LoadSettings()
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniDLWizardVars, true);
     configure = !iniFile.hasSection(iniDLWizardSets);
     if (configure) {
         iniFile.initialize();
         iniFile.save();
     }
     pluginDirs = new List<string>(iniFile.getSectList(iniDLWizardPlugDirs));
     pluginDirs.Sort();
     string lastdir = Statics.fn_datafiles;
     for (int i = 0; i < pluginDirs.Count; i++ ) {
         if (String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(lastdir), true, Statics.Culture) == 0 ||
             String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(Statics.fn_statics), true, Statics.Culture) == 0 ||
             String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(Statics.fn_datafiles), true, Statics.Culture) == 0)
             pluginDirs.RemoveAt(i--);
         else lastdir = pluginDirs[i];
     }
     pluginDirs.Insert(0, Statics.fn_statics);
     preselectedPlugins = iniFile.getSectList(iniDLWizardPlugs);
     pluginList = new MWPlugins(Statics.fn_datafiles, pluginDirs, preselectedPlugins);
     switch ((int)iniFile.getKeyValue("PlugSort")) {
         case 0: rbPlugsName.Checked = true; break;
         case 1: rbPlugsType.Checked = true; break;
         case 2: rbPlugsLoad.Checked = true; break;
     }
     pluginsSort(null, null);
     cmbTexWorldResolution.SelectedIndex = (int)iniFile.getKeyValue("TexRes");
     cmbTexWorldNormalRes.SelectedIndex = (int)iniFile.getKeyValue("NormRes");
     cbTexTwoStep.Checked = (iniFile.getKeyValue("Tex2Step") == 1);
     cmbMeshWorldDetail.SelectedIndex = (int)iniFile.getKeyValue("WorldMesh");
     udStatMinSize.Value = (int)iniFile.getKeyValue("MinStat");
     udStatGrassDensity.Value = (int)iniFile.getKeyValue("GrassDens");
     cmbStatSimplifyMeshes.SelectedIndex = (int)iniFile.getKeyValue("StatMesh");
     cmbStatSkipMipLevels.SelectedIndex = (int)iniFile.getKeyValue("SkipMip");
     cbStatLowQualTextures.Checked = (iniFile.getKeyValue("LowQualTex") == 1);
     cbStatActivators.Checked = (iniFile.getKeyValue("Activators") == 1);
     cbStatIncludeMisc.Checked = (iniFile.getKeyValue("MiscObj") == 1);
     cbStatOldSimplification.Checked = (iniFile.getKeyValue("OldSimply") == 1);
     cbStatOverrideList.Checked = (iniFile.getKeyValue("UseStatOvr") == 1);
     cbStatIntExt.Checked = (iniFile.getKeyValue("StatIntExt") == 1);
     cbStatIntWater.Checked = (iniFile.getKeyValue("StatIntWater") == 1);
     lbStatOverrideList.Items.Clear();
     lbStatOverrideList.Items.AddRange(iniFile.getSectList(iniDLWizardStatOvr));
     lStatOverrideList.Enabled = (lbStatOverrideList.Items.Count == 0);
 }
Example #7
0
 private void LoadGraphicsSettings(bool reset, bool save)
 {
     INIFile iniFile = new INIFile (reset ? Statics.fn_nul : Statics.iniFileName, iniSettings, true);
     if (reset)
         iniFile.fileName = Statics.iniFileName;
     else
         bCalcRefresh_Click (null, null);
     if (save) {
         iniFile.initialize ();
         iniFile.save ();
     }
     loading = true;
     // Config
     cmbTipReadSpd.SelectedIndex = (int)iniFile.getKeyValue ("IipSpeed");
     // Graphics
     cmbAntiAlias.SelectedIndex = (int)iniFile.getKeyValue ("AntiAlias");
     cmbVWait.SelectedIndex = (int)iniFile.getKeyValue ("VWait");
     cmbRefreshRate.SelectedIndex = cmbRefreshRate.FindStringExact (iniFile.getKeyValue ("Refresh").ToString ());
     if (cmbRefreshRate.SelectedIndex == -1) cmbRefreshRate.SelectedIndex = 0;
     cmbAnisoLevel.SelectedIndex = (int)iniFile.getKeyValue ("AnisoLvl");
     udLOD.Value = (decimal)iniFile.getKeyValue ("LODBias");
     cmbFogMode.SelectedIndex = (int)iniFile.getKeyValue ("FogMode");
     udFOV.Value = (decimal)iniFile.getKeyValue ("FOV");
     cbFPSCounter.Checked = (iniFile.getKeyValue ("FPSCount") == 1);
     cbDisplayMessages.Checked = (iniFile.getKeyValue ("Messages") == 1);
     udMsgsTime.Value = (decimal)iniFile.getKeyValue ("MsgTime");
     cbHWShader.Checked = (iniFile.getKeyValue ("HWShader") == 1);
     cmbSShotFormat.SelectedIndex = (int)iniFile.getKeyValue ("SSFormat");
     tbSShotDir.Text = iniFile.getKeyString ("SSDir");
     if (tbSShotDir.Text.Length == 0) bSSDirClear_Click (null, null);
     tbSShotName.Text = iniFile.getKeyString ("SSName");
     udSShotNum.Value = (decimal)iniFile.getKeyValue ("SSNum");
     // In-game
     cbDisableMGE.Checked = (iniFile.getKeyValue ("DisableMGE") == 1);
     cbDisableMWSE.Checked = (iniFile.getKeyValue ("DisableMWSE") == 1);
     udHDR.Value = (decimal)iniFile.getKeyValue ("HDRTime");
     cbCam3rdPrsn.Checked = (iniFile.getKeyValue ("Cam3rdCustom") == 1);
     udCam3rdX.Value = (decimal)iniFile.getKeyValue ("Cam3rdX");
     udCam3rdY.Value = (decimal)iniFile.getKeyValue ("Cam3rdY");
     udCam3rdZ.Value = (decimal)iniFile.getKeyValue ("Cam3rdZ");
     cbAutoCrosshair.Checked = (iniFile.getKeyValue ("AutoCrosshair") == 1);
     cbMenuCaching.Checked = (iniFile.getKeyValue ("MenuCaching") == 1);
     // Distant Land
     cbDLDistantLand.Checked = (iniFile.getKeyValue ("DistLand") == 1);
     cbDLDistantStatics.Checked = (iniFile.getKeyValue ("DistStat") == 1);
     udDLDrawDist.Value = (decimal)iniFile.getKeyValue ("DrawDist");
     udDLDistNear.Value = (decimal)iniFile.getKeyValue ("EndNear");
     udDLDistFar.Value = (decimal)iniFile.getKeyValue ("EndFar");
     udDLDistVeryFar.Value = (int)iniFile.getKeyValue ("EndVFar");
     udDLSizeFar.Value = (decimal)iniFile.getKeyValue ("SizeFar");
     udDLSizeVeryFar.Value = (decimal)iniFile.getKeyValue ("SizeVFar");
     cbDLReflLand.Checked = (iniFile.getKeyValue ("ReflLand") == 1);
     cbDLReflNStatics.Checked = (iniFile.getKeyValue ("ReflNear") == 1);
     cbDLReflInterior.Checked = (iniFile.getKeyValue ("ReflIntr") == 1);
     udDLFogAStart.Value = (decimal)iniFile.getKeyValue ("AboveBeg");
     udDLFogAEnd.Value = (decimal)iniFile.getKeyValue ("AboveEnd");
     udDLFogBStart.Value = (decimal)iniFile.getKeyValue ("BelowBeg");
     udDLFogBEnd.Value = (decimal)iniFile.getKeyValue ("BelowEnd");
     udDLFogIStart.Value = (decimal)iniFile.getKeyValue ("InterBeg");
     udDLFogIEnd.Value = (decimal)iniFile.getKeyValue ("InterEnd");
     cbDLSkyRefl.Checked = (iniFile.getKeyValue ("SkyRefl") == 1);
     cbDLDynRipples.Checked = (iniFile.getKeyValue ("DynRipples") == 1);
     cbDLReflBlur.Checked = (iniFile.getKeyValue ("ReflBlur") == 1);
     udDLFogExpMul.Value = (decimal)iniFile.getKeyValue ("DLExpMul");
     cbDLFogExp.Checked = (iniFile.getKeyValue ("ExpFog") == 1);
     cbDLScattering.Checked = (iniFile.getKeyValue ("Scatter") == 1);
     udDLWtrWave.Value = (decimal)iniFile.getKeyValue ("WaveHght");
     udDLWtrCaust.Value = (decimal)iniFile.getKeyValue ("Caustics");
     int autoDistBy = (int)iniFile.getKeyValue ("AutoDistBy");
     rbDLAutoByDrawDist.Checked = (autoDistBy == 1);
     rbDLAutoByAFogEnd.Checked = (autoDistBy == 2);
     cbDLAutoDist.Checked = (iniFile.getKeyValue ("AutoDist") == 1);
     cbDLSunShadows.Checked = (iniFile.getKeyValue ("SunShadows") == 1);
     cbPerPixelLighting.Checked = (iniFile.getKeyValue ("PPLighting") == 1);
     loading = false;
 }
Example #8
0
 private void bSave_Click(object sender, EventArgs e)
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniWeatherSettings, true);
     iniFile.initialize();
     foreach (Control ctl in this.Controls["gbWind"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         iniFile.setKey(ud.Name.Substring(2), (double)ud.Value);
     }
     foreach (Control ctl in this.Controls["gbFogDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         iniFile.setKey(ud.Name.Substring(2), (double)ud.Value);
     }
     foreach (Control ctl in this.Controls["gbFogOffsDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         iniFile.setKey(ud.Name.Substring(2), (double)ud.Value);
     }
     iniFile.save();
     Close();
 }
Example #9
0
 private void SaveGraphicsSettings()
 {
     INIFile iniFile = new INIFile (Statics.iniFileName, iniSettings, true);
     // Config
     iniFile.setKey ("Version", Statics.versionString);
     iniFile.setKey ("IipSpeed", cmbTipReadSpd.SelectedIndex);
     iniFile.setKey ("Language", cmbUILanguage.Text);
     iniFile.setKey ("AutoLang", cbUILangAuto.Checked);
     iniFile.setKey ("DisableMGE", cbDisableMGE.Checked);
     // Graphics
     iniFile.setKey ("AntiAlias", cmbAntiAlias.SelectedIndex);
     iniFile.setKey ("VWait", cmbVWait.SelectedIndex);
     iniFile.setKey ("Refresh", cmbRefreshRate.Text);
     iniFile.setKey ("AnisoLvl", cmbAnisoLevel.SelectedIndex);
     iniFile.setKey ("LODBias", (double)udLOD.Value);
     iniFile.setKey ("FogMode", cmbFogMode.SelectedIndex);
     iniFile.setKey ("FOV", (double)udFOV.Value);
     iniFile.setKey ("FPSCount", cbFPSCounter.Checked);
     iniFile.setKey ("Messages", cbDisplayMessages.Checked);
     iniFile.setKey ("MsgTime", (double)udMsgsTime.Value);
     iniFile.setKey ("HWShader", cbHWShader.Checked);
     iniFile.setKey ("SSFormat", cmbSShotFormat.SelectedIndex);
     if (tbSShotDir.TextAlign == HorizontalAlignment.Left) iniFile.setKey ("SSDir", tbSShotDir.Text);
     else iniFile.setKey ("SSDir", "");
     iniFile.setKey ("SSName", tbSShotName.Text);
     iniFile.setKey ("SSNum", (double)udSShotNum.Value);
     // In-game
     iniFile.setKey ("DisableMWSE", cbDisableMWSE.Checked);
     iniFile.setKey ("HDRTime", (double)udHDR.Value);
     iniFile.setKey ("Cam3rdCustom", cbCam3rdPrsn.Checked);
     iniFile.setKey ("Cam3rdX", (double)udCam3rdX.Value);
     iniFile.setKey ("Cam3rdY", (double)udCam3rdY.Value);
     iniFile.setKey ("Cam3rdZ", (double)udCam3rdZ.Value);
     iniFile.setKey ("AutoCrosshair", cbAutoCrosshair.Checked);
     iniFile.setKey ("MenuCaching", cbMenuCaching.Checked);
     // Distant Land
     iniFile.setKey ("DistLand", cbDLDistantLand.Checked);
     iniFile.setKey ("DistStat", cbDLDistantStatics.Checked);
     iniFile.setKey ("DrawDist", (double)udDLDrawDist.Value);
     iniFile.setKey ("AutoDist", cbDLAutoDist.Checked);
     iniFile.setKey ("AutoDistBy", rbDLAutoByAFogEnd.Checked ? 2 : 1);
     iniFile.setKey ("EndNear", (double)udDLDistNear.Value);
     iniFile.setKey ("EndFar", (double)udDLDistFar.Value);
     iniFile.setKey ("EndVFar", (double)udDLDistVeryFar.Value);
     iniFile.setKey ("SizeFar", (double)udDLSizeFar.Value);
     iniFile.setKey ("SizeVFar", (double)udDLSizeVeryFar.Value);
     iniFile.setKey ("ReflLand", cbDLReflLand.Checked);
     iniFile.setKey ("ReflNear", cbDLReflNStatics.Checked);
     iniFile.setKey ("ReflIntr", cbDLReflInterior.Checked);
     iniFile.setKey ("SkyRefl", cbDLSkyRefl.Checked);
     iniFile.setKey ("ReflBlur", cbDLReflBlur.Checked);
     iniFile.setKey ("DynRipples", cbDLDynRipples.Checked);
     iniFile.setKey ("WaveHght", (double)udDLWtrWave.Value);
     iniFile.setKey ("Caustics", (double)udDLWtrCaust.Value);
     iniFile.setKey ("AboveBeg", (double)udDLFogAStart.Value);
     iniFile.setKey ("AboveEnd", (double)udDLFogAEnd.Value);
     iniFile.setKey ("BelowBeg", (double)udDLFogBStart.Value);
     iniFile.setKey ("BelowEnd", (double)udDLFogBEnd.Value);
     iniFile.setKey ("InterBeg", (double)udDLFogIStart.Value);
     iniFile.setKey ("InterEnd", (double)udDLFogIEnd.Value);
     iniFile.setKey ("ExpFog", cbDLFogExp.Checked);
     iniFile.setKey ("DLExpMul", (double)udDLFogExpMul.Value);
     iniFile.setKey ("Scatter", cbDLScattering.Checked);
     iniFile.setKey ("SunShadows", cbDLSunShadows.Checked);
     iniFile.setKey ("PPLighting", cbPerPixelLighting.Checked);
     iniFile.save ();
     try {
         RegistryKey key = Registry.LocalMachine.OpenSubKey (Statics.reg_mw, true);
         if (key != null) {
             key.SetValue ("Pixelshader", new byte [] { Convert.ToByte (cbDisableMGE.Checked) });
             key.Close ();
         }
     } catch { }
 }
Example #10
0
 private void SaveMWINI()
 {
     INIFile mwini = new INIFile (Statics.fn_mwini, mwSettings, System.Text.Encoding.Default, true);
     mwini.setKey ("SSEnable", cbScreenshots.Checked);
     mwini.setKey ("NoThread", !cbThreadLoad.Checked);
     mwini.setKey ("YesToAll", cbYesToAll.Checked);
     mwini.setKey ("HDShadow", cbHQShadows.Checked);
     mwini.setKey ("ShowFPS", cbShowFPS.Checked);
     mwini.setKey ("AudioOff", cbAudio.Checked);
     mwini.setKey ("Subtitles", cbSubtitles.Checked);
     mwini.setKey ("HitFader", cbHitFader.Checked);
     mwini.setKey ("MultiCS", cbMultipleCS.Checked);
     mwini.save ();
 }
Example #11
0
 private void tvPatch_AfterEditing(object sender, TreeViewEventArgs e)
 {
     if (!loaded) return;
     UpdateColour(tvPatch.Nodes, true);
     List<INIFile.INIVariableDef> guimcp = new List<INIFile.INIVariableDef> { INIFile.iniDefEmpty };
     SaveNodes(tvPatch.Nodes, guimcp);
     INIFile mcpFile = new INIFile(patchSettings, guimcp.ToArray(), true);
     mcpFile.reinitialize();
     mcpFile.save();
 }
Example #12
0
 private void SaveGraphicsSettings()
 {
     INIFile iniFile = new INIFile (Statics.iniFileName, iniSettings, true);
     //Main
     iniFile.setKey ("Version", Statics.versionString);
     iniFile.setKey ("IipSpeed", cmbTipReadSpd.SelectedIndex);
     iniFile.setKey ("Language", cmbUILanguage.Text);
     iniFile.setKey ("AutoLang", cbUILangAuto.Checked);
     //MGE disabled
     iniFile.setKey ("DisableMGE", cbDisableMGE.Checked);
     //Global Graphics
     iniFile.setKey ("AntiAlias", cmbAntiAlias.SelectedIndex);
     iniFile.setKey ("ZBuffer", cmbZBuffer.SelectedIndex);
     iniFile.setKey ("VWait", cmbVWait.SelectedIndex);
     iniFile.setKey ("Refresh", cmbRefreshRate.Text);
     //Render State
     iniFile.setKey ("ScaleFilt", cmbScaleFilter.SelectedIndex);
     iniFile.setKey ("MipFilt", cmbMipFilter.SelectedIndex);
     iniFile.setKey ("AnisoLvl", cmbAnisoLevel.SelectedIndex);
     iniFile.setKey ("LODBias", (double)udLOD.Value);
     iniFile.setKey ("FogMode", cmbFogMode.SelectedIndex);
     iniFile.setKey ("InitZoom", (double)udZoom.Value);
     iniFile.setKey ("ScrRot", (double)udRotation.Value);
     iniFile.setKey ("FOV", (double)udFOV.Value);
     iniFile.setKey ("UseFog", cbFog.Checked);
     iniFile.setKey ("FPSCount", cbFPSCounter.Checked);
     iniFile.setKey ("Messages", cbDisplayMessages.Checked);
     iniFile.setKey ("MsgTime", (double)udMsgsTime.Value);
     iniFile.setKey ("HWShader", cbHWShader.Checked);
     iniFile.setKey("DisableShadersInMenu", cbDisableShadersInMenu.Checked);
     iniFile.setKey ("AAFix", cbAAFix.Checked);
     iniFile.setKey ("SSFormat", cmbSShotFormat.SelectedIndex);
     if (tbSShotDir.TextAlign == HorizontalAlignment.Left) iniFile.setKey ("SSDir", tbSShotDir.Text);
     else iniFile.setKey ("SSDir", "");
     iniFile.setKey ("SSName", tbSShotName.Text);
     iniFile.setKey ("SSNum", (double)udSShotNum.Value);
     //Input
     iniFile.setKey ("LagFix", cbLagFix.Checked);
     //Misc
     iniFile.setKey ("DisableMWSE", cbDisableMWSE.Checked);
     iniFile.setKey ("DisableMWE", cbDisableMWE.CheckState == CheckState.Checked);
     iniFile.setKey ("DisableIntegration", cbDisableIntegration.Checked);
     iniFile.setKey ("DisablePatch", cbDisablePatch.Checked);
     iniFile.setKey ("AffectUI", cbZoomEffectsHUD.Checked);
     iniFile.setKey ("AspectZoom", cbAspectZoom.Checked);
     iniFile.setKey ("HookTex", cbHook.Checked);
     iniFile.setKey ("ShaderVars", cbSetEffectVars.Checked);
     iniFile.setKey ("ShaderDepth", cbShaderDepth.Checked);
     iniFile.setKey ("UseHDR", cbHDR.Checked);
     iniFile.setKey ("HDRTime", (double)udHDR.Value);
     iniFile.setKey ("KeepFPS", cbFPSConst.Checked);
     iniFile.setKey ("FPSDesired", (double)udFPSDes.Value);
     iniFile.setKey ("FPSToler", (double)udFPSTol.Value);
     iniFile.setKey ("MaxMWView", (double)udMaxView.Value);
     iniFile.setKey ("MinMWView", (double)udMinView.Value);
     iniFile.setKey ("AIToMWView", cbBindAI.Checked);
     iniFile.setKey ("CPUIdle", cbIdle.Checked);
     iniFile.setKey ("IdleTime", (double)udIdle.Value);
     iniFile.setKey ("Cam3rdCustom", cbCam3rdPrsn.Checked);
     iniFile.setKey ("Cam3rdX", (double)udCam3rdX.Value);
     iniFile.setKey ("Cam3rdY", (double)udCam3rdY.Value);
     iniFile.setKey ("Cam3rdZ", (double)udCam3rdZ.Value);
     //Distant Land
     iniFile.setKey ("DistLand", cbDLDistantLand.Checked);
     iniFile.setKey ("DistStat", cbDLDistantStatics.Checked);
     iniFile.setKey ("DLShader", rbDLSM30.Checked ? 3 : 2);
     foreach (KeyValuePair<string, bool> v in DLOptions) iniFile.setKey (v.Key, v.Value);
     iniFile.setKey ("DrawDist", (double)udDLDrawDist.Value);
     iniFile.setKey ("AutoDist", cbDLAutoDist.Checked);
     int autoDistBy;
     if (rbDLAutoByAFogEnd.Checked) autoDistBy = 2;
     else autoDistBy = 1;
     iniFile.setKey ("AutoDistBy", autoDistBy);
     //iniFile.setKey ("DistBlur", (double)udDLBlur.Value);  //removed
     iniFile.setKey ("EndNear", (double)udDLDistNear.Value);
     iniFile.setKey ("EndFar", (double)udDLDistFar.Value);
     iniFile.setKey ("EndVFar", (double)udDLDistVeryFar.Value);
     iniFile.setKey ("SizeFar", (double)udDLSizeFar.Value);
     iniFile.setKey ("SizeVFar", (double)udDLSizeVeryFar.Value);
     iniFile.setKey ("ReflLand", cbDLReflLand.Checked);
     iniFile.setKey ("ReflNear", cbDLReflNStatics.Checked);
     iniFile.setKey ("ReflFar", cbDLReflFStatics.Checked);
     iniFile.setKey ("SkyRefl", cbDLSkyRefl.Checked);
     iniFile.setKey ("ReflBlur", cbDLReflBlur.Checked);
     iniFile.setKey ("DynRipples", cbDLDynRipples.Checked);
     iniFile.setKey ("WaveHght", (double)udDLWtrWave.Value);
     iniFile.setKey ("Caustics", (double)udDLWtrCaust.Value);
     iniFile.setKey ("AboveBeg", (double)udDLFogAStart.Value);
     iniFile.setKey ("AboveEnd", (double)udDLFogAEnd.Value);
     iniFile.setKey ("BelowBeg", (double)udDLFogBStart.Value);
     iniFile.setKey ("BelowEnd", (double)udDLFogBEnd.Value);
     iniFile.setKey ("InterBeg", (double)udDLFogIStart.Value);
     iniFile.setKey ("InterEnd", (double)udDLFogIEnd.Value);
     iniFile.setKey ("ExpFog", cbDLFogExp.Checked);
     iniFile.setKey ("DLExpMul", (double)udDLFogExpMul.Value);
     //Tools
     iniFile.setKey("PTreeWidth", (double)PatchTreeSize.Width);
     iniFile.setKey("PTreeHeight", (double)PatchTreeSize.Height);
     iniFile.setKey("PEditorWidth", (double)PatchEditorSize.Width);
     iniFile.setKey("PEditorHeight", (double)PatchEditorSize.Height);
     iniFile.setKey("PEditorBarW", (double)PatchEditorBars.Width);
     iniFile.setKey("PEditorBarH", (double)PatchEditorBars.Height);
     iniFile.save ();
     try {
         RegistryKey key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind, true);
         if (key != null) {
             key.SetValue ("Pixelshader", new byte [] { Convert.ToByte (!gbDistantLand.Enabled) });
             key.Close ();
         }
     } catch { }
 }
Example #13
0
 private void LoadGraphicsSettings(bool reset, bool save)
 {
     INIFile iniFile = new INIFile (reset ? Statics.fn_nul : Statics.iniFileName, iniSettings, true);
     if (reset) iniFile.fileName = Statics.iniFileName;
     else bCalcRefresh_Click (null, null);
     if (save) {
         iniFile.initialize ();
         iniFile.save ();
     }
     loading = true;
     //Main
     cmbTipReadSpd.SelectedIndex = (int)iniFile.getKeyValue ("IipSpeed");
     //Global Graphics
     cmbAntiAlias.SelectedIndex = (int)iniFile.getKeyValue ("AntiAlias");
     cmbZBuffer.SelectedIndex = (int)iniFile.getKeyValue ("ZBuffer");
     cmbVWait.SelectedIndex = (int)iniFile.getKeyValue ("VWait");
     cmbRefreshRate.SelectedIndex = cmbRefreshRate.FindStringExact (iniFile.getKeyValue ("Refresh").ToString ());
     if (cmbRefreshRate.SelectedIndex == -1) cmbRefreshRate.SelectedIndex = 0;
     //Render State
     cmbScaleFilter.SelectedIndex = (int)iniFile.getKeyValue ("ScaleFilt");
     cmbMipFilter.SelectedIndex = (int)iniFile.getKeyValue ("MipFilt");
     cmbAnisoLevel.SelectedIndex = (int)iniFile.getKeyValue ("AnisoLvl");
     udLOD.Value = (int)iniFile.getKeyValue ("LODBias");
     cmbFogMode.SelectedIndex = (int)iniFile.getKeyValue ("FogMode");
     udZoom.Value = (decimal)iniFile.getKeyValue ("InitZoom");
     udRotation.Value = (decimal)iniFile.getKeyValue ("ScrRot");
     udFOV.Value = (decimal)iniFile.getKeyValue ("FOV");
     cbFog.Checked = (iniFile.getKeyValue ("UseFog") == 1);
     cbFPSCounter.Checked = (iniFile.getKeyValue ("FPSCount") == 1);
     cbDisplayMessages.Checked = (iniFile.getKeyValue ("Messages") == 1);
     udMsgsTime.Value = (decimal)iniFile.getKeyValue ("MsgTime");
     cbHWShader.Checked = (iniFile.getKeyValue ("HWShader") == 1);
     cbDisableShadersInMenu.Checked = (iniFile.getKeyValue("DisableShadersInMenu") == 1);
     cbAAFix.Checked = (iniFile.getKeyValue ("AAFix") == 1);
     cmbSShotFormat.SelectedIndex = (int)iniFile.getKeyValue ("SSFormat");
     tbSShotDir.Text = iniFile.getKeyString ("SSDir");
     if (tbSShotDir.Text.Length == 0) bSSDirClear_Click (null, null);
     tbSShotName.Text = iniFile.getKeyString ("SSName");
     udSShotNum.Value = (decimal)iniFile.getKeyValue ("SSNum");
     //Input
     cbLagFix.Checked = (iniFile.getKeyValue ("LagFix") == 1);
     //Misc
     cbDisableMWSE.Checked = (iniFile.getKeyValue ("DisableMWSE") == 1);
     cbDisableMWE.CheckState = (iniFile.getKeyValue("DisableMWE") == 1) ? CheckState.Checked : File.Exists(Statics.fn_mwedll) ? CheckState.Unchecked : CheckState.Indeterminate;
     cbDisableIntegration.Checked = (iniFile.getKeyValue("DisableIntegration") == 1);
     cbDisablePatch.Checked = (iniFile.getKeyValue("DisablePatch") == 1);
     cbZoomEffectsHUD.Checked = (iniFile.getKeyValue ("AffectUI") == 1);
     cbAspectZoom.Checked = (iniFile.getKeyValue ("AspectZoom") == 1);
     cbHook.Checked = (iniFile.getKeyValue ("HookTex") == 1);
     cbSetEffectVars.Checked = (iniFile.getKeyValue ("ShaderVars") == 1);
     cbHDR.Checked = (iniFile.getKeyValue ("UseHDR") == 1);
     udHDR.Value = (decimal)iniFile.getKeyValue ("HDRTime");
     cbFPSConst.Checked = (iniFile.getKeyValue ("KeepFPS") == 1);
     udFPSDes.Value = (int)iniFile.getKeyValue ("FPSDesired");
     udFPSTol.Value = (int)iniFile.getKeyValue ("FPSToler");
     udMaxView.Value = (int)iniFile.getKeyValue ("MaxMWView");
     udMinView.Value = (int)iniFile.getKeyValue ("MinMWView");
     cbBindAI.Checked = (iniFile.getKeyValue ("AIToMWView") == 1);
     cbIdle.Checked = (iniFile.getKeyValue ("CPUIdle") == 1);
     udIdle.Value = (int)iniFile.getKeyValue ("IdleTime");
     cbShaderDepth.Checked = (iniFile.getKeyValue ("ShaderDepth") == 1);
     cbCam3rdPrsn.Checked = (iniFile.getKeyValue ("Cam3rdCustom") == 1);
     udCam3rdX.Value = (decimal)iniFile.getKeyValue ("Cam3rdX");
     udCam3rdY.Value = (decimal)iniFile.getKeyValue ("Cam3rdY");
     udCam3rdZ.Value = (decimal)iniFile.getKeyValue ("Cam3rdZ");
     //Distant Land
     cbDLDistantLand.Checked = (iniFile.getKeyValue ("DistLand") == 1);
     List<string> list = new List<string> (DLOptions.Keys);
     foreach (string key in list) DLOptions [key] = (iniFile.getKeyValue (key) == 1);
     cbDLDistantStatics.Checked = (iniFile.getKeyValue ("DistStat") == 1);
     udDLDrawDist.Value = (decimal)iniFile.getKeyValue ("DrawDist");
     //udDLBlur.Value = (int)iniFile.getKeyValue ("DistBlur");   //removed
     udDLDistNear.Value = (decimal)iniFile.getKeyValue ("EndNear");
     udDLDistFar.Value = (decimal)iniFile.getKeyValue ("EndFar");
     udDLDistVeryFar.Value = (int)iniFile.getKeyValue ("EndVFar");
     udDLSizeFar.Value = (decimal)iniFile.getKeyValue ("SizeFar");
     udDLSizeVeryFar.Value = (decimal)iniFile.getKeyValue ("SizeVFar");
     cbDLReflLand.Checked = (iniFile.getKeyValue ("ReflLand") == 1);
     cbDLReflNStatics.Checked = (iniFile.getKeyValue ("ReflNear") == 1);
     cbDLReflFStatics.Checked = (iniFile.getKeyValue ("ReflFar") == 1);
     udDLFogAStart.Value = (decimal)iniFile.getKeyValue ("AboveBeg");
     udDLFogAEnd.Value = (decimal)iniFile.getKeyValue ("AboveEnd");
     udDLFogBStart.Value = (decimal)iniFile.getKeyValue ("BelowBeg");
     udDLFogBEnd.Value = (decimal)iniFile.getKeyValue ("BelowEnd");
     udDLFogIStart.Value = (decimal)iniFile.getKeyValue ("InterBeg");
     udDLFogIEnd.Value = (decimal)iniFile.getKeyValue ("InterEnd");
     cbDLSkyRefl.Checked = (iniFile.getKeyValue ("SkyRefl") == 1);
     cbDLDynRipples.Checked = (iniFile.getKeyValue ("DynRipples") == 1);
     rbDLSM30.Checked = (iniFile.getKeyValue ("DLShader") == 3);
     cbDLReflBlur.Checked = (iniFile.getKeyValue ("ReflBlur") == 1);
     udDLFogExpMul.Value = (decimal)iniFile.getKeyValue ("DLExpMul");
     cbDLFogExp.Checked = (iniFile.getKeyValue ("ExpFog") == 1);
     udDLWtrWave.Value = (decimal)iniFile.getKeyValue ("WaveHght");
     udDLWtrCaust.Value = (decimal)iniFile.getKeyValue ("Caustics");
     int autoDistBy = (int)iniFile.getKeyValue ("AutoDistBy");
     rbDLAutoByDrawDist.Checked = (autoDistBy == 1);
     rbDLAutoByAFogEnd.Checked = (autoDistBy == 2);
     cbDLAutoDist.Checked = (iniFile.getKeyValue ("AutoDist") == 1);
     //MGE disabled
     cbDisableMGE.Checked = (iniFile.getKeyValue ("DisableMGE") == 1);
     //Tools
     PatchTreeSize.Width = (int)iniFile.getKeyValue("PTreeWidth");
     PatchTreeSize.Height = (int)iniFile.getKeyValue("PTreeHeight");
     PatchEditorSize.Width = (int)iniFile.getKeyValue("PEditorWidth");
     PatchEditorSize.Height = (int)iniFile.getKeyValue("PEditorHeight");
     PatchEditorBars.Width = (int)iniFile.getKeyValue("PEditorBarW");
     PatchEditorBars.Height = (int)iniFile.getKeyValue("PEditorBarH");
     loading = false;
 }
Example #14
0
 private void bResetSettings_Click(object sender, EventArgs e)
 {
     bool delete = cbClearINI.Checked;
     DialogResult res = MessageBox.Show (String.Format (strings ["AskReset"].text, (delete ? strings ["ResetSaved"].text : "")), strings ["ResetAsk"].text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
     if (res == DialogResult.Yes) {
         LoadGraphicsSettings (true, delete);
         INIFile iniFile = new INIFile (Statics.iniFileName, DLWeatherForm.iniWeatherSettings, true);
         iniFile.reinitialize ();
         iniFile.save ();
         cbSkipMovie.Checked = false;
         cbConsole.Checked = false;
         cbClearINI.Checked = false;
         cbImportIni.Checked = false;
         cbAltCombat.Checked = false;
     }
 }
Example #15
0
 // saving settings after land mesh creation
 private void SaveMeshSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniMeshTab, true);
     iniFile.setKey("WorldMesh", (cmbMeshWorldDetail_auto ? -1 : (double)cmbMeshWorldDetail.SelectedIndex));
     iniFile.save();
 }
Example #16
0
        private void SaveMWINI()
        {
            INIFile mwini = new INIFile (Statics.fn_mwini, mwSettings, System.Text.Encoding.Default, true);

            mwini.setKey("FPSLimit", (int)udFPSLimit.Value);
            mwini.setKey ("SSEnable", cbScreenshots.Checked);
            mwini.setKey ("NoThread", !cbThreadLoad.Checked);
            mwini.setKey ("YesToAll", cbYesToAll.Checked);
            mwini.setKey ("HDShadow", cbHQShadows.Checked);
            mwini.setKey ("ShowFPS", cbShowFPS.Checked);
            mwini.setKey ("AudioOff", cbAudio.Checked);
            mwini.setKey ("Subtitles", cbSubtitles.Checked);
            mwini.setKey ("HitFader", cbHitFader.Checked);

            mwini.setKey("UseConstant", true);
            mwini.setKey("ConstantValue", Decimal.ToSingle(udLightingConst.Value));
            mwini.setKey("UseLinear", true);
            mwini.setKey("LinearValue", Decimal.ToSingle(udLightingLinear.Value));
            mwini.setKey("UseQuadratic", true);
            mwini.setKey("QuadraticValue", Decimal.ToSingle(udLightingQuad.Value));

            mwini.save ();
        }
Example #17
0
 // saving settings after statics creation
 private void SaveStatSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniStatTab, true);
     iniFile.setKey("MinStat", (double)udStatMinSize.Value);
     iniFile.setKey("GrassDens", (double)udStatGrassDensity.Value);
     iniFile.setKey("StatMesh", cmbStatSimplifyMeshes.SelectedIndex);
     iniFile.setKey("SkipMip", cmbStatSkipMipLevels.SelectedIndex);
     iniFile.setKey("Activators", cbStatActivators.Checked);
     iniFile.setKey("MiscObj", cbStatIncludeMisc.Checked);
     iniFile.setKey("UseStatOvr", cbStatOverrideList.Checked);
     iniFile.setKey("StatIntExt", cbStatIntExt.Checked);
     iniFile.setKey("StatIntWater", cbStatIntWater.Checked);
     List<string> tempList = new List<string>();
     foreach (string s in lbStatOverrideList.Items) tempList.Add(s);
     iniFile.setSectOrderedList(iniDLWizardStatOvr, tempList.ToArray());
     iniFile.save();
 }
Example #18
0
 // saving settings after plugin selection
 private void SavePlugsSettings()
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniPlugsTab, true);
     iniFile.setKey("PlugSort", rbPlugsName.Checked ? 0d : rbPlugsType.Checked ? 1d : rbPlugsLoad.Checked ? 2d : 2d);
     List<String> items = new List<String>(pluginDirs);
     for (int i = 0; i < items.Count; i++) if (String.Compare(Path.GetFullPath(items[i]), Path.GetFullPath(Statics.fn_statics), true, Statics.Culture) == 0) items.RemoveAt(i--);
     iniFile.setSectList(iniDLWizardPlugDirs, items.ToArray());
     List<String> checkeditems = new List<String>();
     foreach (String item in clbPlugsModList.CheckedItems) if (pluginList.Plugins[item.ToLower(Statics.Culture)].Checked == CheckState.Checked) checkeditems.Add(item);
     iniFile.setSectList(iniDLWizardPlugs, checkeditems.ToArray());
     iniFile.save();
 }