public static void Main(string[] sargs) { Thread.CurrentThread.CurrentUICulture = Culture; CommandArgs args = new CommandArgs (sargs); if (args.styles) Application.EnableVisualStyles (); // Damn .NET text rendering Application.SetCompatibleTextRenderingDefault(false); Directory.SetCurrentDirectory (System.IO.Path.GetDirectoryName (Application.ExecutablePath)); Localizations = new LocalizationInterface (); try { string [] langfiles = Directory.GetFiles ("MGE3", "*.lng"); foreach (string langfile in langfiles) { Localizations.Add (langfile); } } catch { }; string language = "English (default)"; bool autoLanguage = true; try { INIFile MGEini = new INIFile (iniFileName, new INIFile.INIVariableDef [] { INIFile.iniDefEmpty, MainForm.iniLanguage, MainForm.iniAutoLang }); language = MGEini.getKeyString ("Language"); autoLanguage = (MGEini.getKeyValue ("AutoLang") == 1); } catch { } Localizations.Current = language; Localizations.ApplyStrings("", strings); if (args.mutex && !MutexCheck.PerformCheck ()) { MessageBox.Show (strings ["MGEguiRunning"], strings ["Error"]); return; } Process [] morrowind = Process.GetProcessesByName ("Morrowind"); foreach (Process p in morrowind) { MessageBox.Show (strings ["MWRunning"], strings ["Error"]); return; } if (!File.Exists ("./morrowind.exe") || !File.Exists ("./morrowind.ini") || !Directory.Exists ("data files")) { MessageBox.Show (strings ["NotMWDir"], strings ["Error"]); return; } if (!Directory.Exists ("MGE3") || !File.Exists ("./MGE3/MGEfuncs.dll") || !File.Exists ("./d3d8.dll") || !File.Exists ("./dinput8.dll")) { MessageBox.Show (strings ["MGEMissing"], strings ["Error"]); return; } //Morrowind version info try { FileVersionInfo MorrowVersion = FileVersionInfo.GetVersionInfo ("Morrowind.exe"); if (MorrowVersion.FileMajorPart != 1 || MorrowVersion.FileMinorPart < 6) { MessageBox.Show (strings ["MWIncompat"], strings ["Error"]); return; } } catch { MessageBox.Show (strings ["MWCorrupt"], strings ["Error"]); return; } runDir = System.Windows.Forms.Application.StartupPath; //check if MW registry keys exist if (Registry.LocalMachine.OpenSubKey (reg_mw) == null) { MessageBox.Show (strings ["MWRegistry"], strings ["Error"]); return; } //Create some structures for (int i = 0; i < MACROS; i++) { Macros [i] = new Macro (); } for (int i = 0; i < TRIGGERS; i++) { Triggers [i] = new Trigger (); } DXMain.GetDeviceCaps (); mf = new MainForm (autoLanguage); Application.Run (mf); }
/* 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); }
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; }
public static void Main(string[] sargs) { Thread.CurrentThread.CurrentUICulture = Culture; CommandArgs args = new CommandArgs (sargs); if (args.styles) Application.EnableVisualStyles (); // Damn .NET text rendering Application.SetCompatibleTextRenderingDefault(false); Directory.SetCurrentDirectory (System.IO.Path.GetDirectoryName (Application.ExecutablePath)); Localizations = new LocalizationInterface (); try { string [] langfiles = Directory.GetFiles ("MGE3", "*.lng"); foreach (string langfile in langfiles) { Localizations.Add (langfile); } } catch { }; Localizations.Add(new LocalizationInterface.Localization((Form)null)); // Adds truncated variant of default localization. String language = DefaultLocalization.Language; bool autoLanguage = true; try { INIFile MGEini = new INIFile (iniFileName, new INIFile.INIVariableDef [] { INIFile.iniDefEmpty, MainForm.iniLanguage, MainForm.iniAutoLang }); language = MGEini.getKeyString ("Language"); autoLanguage = (MGEini.getKeyValue ("AutoLang") == 1); } catch { } Localizations.Current = language; Localizations.ApplyStrings("", strings); if (args.mutex && !MutexCheck.PerformCheck ()) { MessageBox.Show (strings ["MGEguiRunning"], strings ["Error"]); return; } Process [] morrowind = Process.GetProcessesByName ("Morrowind"); foreach (Process p in morrowind) { MessageBox.Show (strings ["MWRunning"], strings ["Error"]); return; } if (!File.Exists ("./morrowind.exe") || !File.Exists ("./morrowind.ini") || !Directory.Exists ("data files")) { MessageBox.Show (strings ["NotMWDir"], strings ["Error"]); return; } if (!Directory.Exists ("MGE3") || !File.Exists ("./MGE3/MGEfuncs.dll") || !File.Exists ("./d3d8.dll") || !File.Exists ("./dinput8.dll")) { MessageBox.Show (strings ["MGEMissing"], strings ["Error"]); return; } //Morrowind version info try { FileVersionInfo MorrowVersion = FileVersionInfo.GetVersionInfo ("Morrowind.exe"); if (MorrowVersion.ProductPrivatePart != 722 && MorrowVersion.ProductPrivatePart != 1029 && MorrowVersion.ProductPrivatePart != 1875 && MorrowVersion.ProductPrivatePart != 1820) { MessageBox.Show (strings ["MWIncompat"], strings ["Error"]); return; } } catch { MessageBox.Show (strings ["MWCorrupt"], strings ["Error"]); return; } //Check for dsound.dll if (File.Exists ("dsound.dll") && new System.IO.FileInfo ("dsound.dll").Length == 16384) { try { File.Delete ("dsound.dll"); } catch { MessageBox.Show (strings ["DSound"], strings ["Error"]); return; } } runDir = System.Windows.Forms.Application.StartupPath; //check if MW registry keys exist RegistryKey key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind); if (key != null) { key.Close(); key = null; } else { MessageBox.Show (strings ["MWRegistry"], strings ["Error"]); return; } //mendres: Check if MGE needs administrator privileges. try { key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind, true); } catch (System.Security.SecurityException) { MessageBox.Show(strings["MgeAccess"], strings["Error"]); return; } if (key != null) { key.Close(); key = null; } //Create the data files directories MGE uses if (!Directory.Exists (@"data files\shaders")) { Directory.CreateDirectory (@"data files\shaders"); } if (!Directory.Exists (@"data files\MGE meshes")) { Directory.CreateDirectory (@"data files\MGE meshes"); } if (!Directory.Exists (@"data files\Textures\MGE")) { Directory.CreateDirectory (@"data files\Textures\MGE"); } if (!Directory.Exists (@"data files\MGE videos")) { Directory.CreateDirectory (@"data files\MGE videos"); } if (!Directory.Exists (@"data files\shaders\default")) { Directory.CreateDirectory (@"data files\shaders\default"); } if (!Directory.Exists (@"data files\shaders\water")) { Directory.CreateDirectory (@"data files\shaders\water"); } //Create some structures for (int i = 0; i < MACROS; i++) { Macros [i] = new Macro (); } for (int i = 0; i < TRIGGERS; i++) { Triggers [i] = new Trigger (); } DXMain.GetDeviceCaps (); bool GUIchecker = !lightversion; while (GUIchecker != lightversion) { GUIchecker = lightversion; if (lightversion) { mfl = new MainFormLight(autoLanguage); Application.Run(mfl); } else { mf = new MainForm (autoLanguage); Application.Run (mf); } } }
private void LoadMWINI() { INIFile mwini = new INIFile(Statics.fn_mwini, mwSettings, System.Text.Encoding.Default); // Clamp to 120fps maximum double fpslimit = Math.Min(mwini.getKeyValue("FPSLimit"), 120.0); udFPSLimit.Value = new Decimal(fpslimit); cbScreenshots.Checked = (mwini.getKeyValue("SSEnable") == 1); cbThreadLoad.Checked = (mwini.getKeyValue("NoThread") != 1); cbYesToAll.Checked = (mwini.getKeyValue("YesToAll") == 1); cbHQShadows.Checked = (mwini.getKeyValue("HDShadow") == 1); cbShowFPS.Checked = (mwini.getKeyValue("ShowFPS") == 1); cbAudio.Checked = (mwini.getKeyValue("AudioOff") == 1); cbSubtitles.Checked = (mwini.getKeyValue("Subtitles") == 1); cbHitFader.Checked = (mwini.getKeyValue("HitFader") == 1); if(mwini.getKeyValue("UseConstant") == 1) udLightingConst.Value = new Decimal(mwini.getKeyValue("ConstantValue")); if(mwini.getKeyValue("UseLinear") == 1) udLightingLinear.Value = new Decimal(mwini.getKeyValue("LinearValue")); if(mwini.getKeyValue("UseQuadratic") == 1) udLightingQuad.Value = new Decimal(mwini.getKeyValue("QuadraticValue")); }
private void LoadSettings() { INIFile iniFile = new INIFile(Statics.iniFileName, iniWeatherSettings); foreach (Control ctl in this.Controls["gbWind"].Controls) { if (ctl.Name.Substring(0, 2) != "ud") continue; NumericUpDown ud = (NumericUpDown)ctl; ud.Value = (decimal)iniFile.getKeyValue(ud.Name.Substring(2)); } foreach (Control ctl in this.Controls["gbFogDay"].Controls) { if (ctl.Name.Substring(0, 2) != "ud") continue; NumericUpDown ud = (NumericUpDown)ctl; ud.Value = (decimal)iniFile.getKeyValue(ud.Name.Substring(2)); } foreach (Control ctl in this.Controls["gbFogOffsDay"].Controls) { if (ctl.Name.Substring(0, 2) != "ud") continue; NumericUpDown ud = (NumericUpDown)ctl; ud.Value = (decimal)iniFile.getKeyValue(ud.Name.Substring(2)); } iniFile = new INIFile("NUL", iniWeatherSettings); foreach (Control ctl in this.Controls["gbWind"].Controls) { if (ctl.Name.Substring(0, 2) != "ud") continue; NumericUpDown ud = (NumericUpDown)ctl; string s = ud.Name.Substring(2); defaults.Add(s, (float)iniFile.getKeyValue(s)); } foreach (Control ctl in this.Controls["gbFogDay"].Controls) { if (ctl.Name.Substring(0, 2) != "ud") continue; NumericUpDown ud = (NumericUpDown)ctl; string s = ud.Name.Substring(2); defaults.Add(s, (float)iniFile.getKeyValue(s)); } foreach (Control ctl in this.Controls["gbFogOffsDay"].Controls) { if (ctl.Name.Substring(0, 2) != "ud") continue; NumericUpDown ud = (NumericUpDown)ctl; string s = ud.Name.Substring(2); defaults.Add(s, (float)iniFile.getKeyValue(s)); } }
private void LoadMWINI() { INIFile mwini = new INIFile (Statics.fn_mwini, mwSettings, System.Text.Encoding.Default); cbScreenshots.Checked = (mwini.getKeyValue ("SSEnable") == 1); cbThreadLoad.Checked = (mwini.getKeyValue ("NoThread") != 1); cbYesToAll.Checked = (mwini.getKeyValue ("YesToAll") == 1); cbHQShadows.Checked = (mwini.getKeyValue ("HDShadow") == 1); cbShowFPS.Checked = (mwini.getKeyValue ("ShowFPS") == 1); cbAudio.Checked = (mwini.getKeyValue ("AudioOff") == 1); cbSubtitles.Checked = (mwini.getKeyValue ("Subtitles") == 1); cbHitFader.Checked = (mwini.getKeyValue ("HitFader") == 1); cbMultipleCS.Checked = (mwini.getKeyValue ("MultiCS") == 1); }
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; }
/* 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); }