public static bool ShowDialog(out Point p, bool Windowed) { //Fetch data from the registry RegistryKey key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind); sWidth=(int)key.GetValue("Screen Width"); sHeight=(int)key.GetValue("Screen Height"); Adaptor=DirectX.DXMain.Adapter; Fullscreen=!Windowed; key.Close(); //Get the list of valid resolutions Resolutions=DirectX.DXMain.GetResolutions(); //Show the dialog ResolutionForm rf=new ResolutionForm(); if(rf.ShowDialog()==DialogResult.OK) { //Write new dtat to the registry try { key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind, true); } catch { MessageBox.Show("Could not write Morrowind registry key. MGE needs to be launched as Administrator.", "Error"); } if (key != null) { key.SetValue("Screen Width", sWidth); key.SetValue("Screen Height", sHeight); key.Close(); } //Return p=new Point(sWidth, sHeight); return true; } p=new Point(); return false; }
public static bool ShowDialog(out Point p, bool Windowed) { //Fetch data from the registry RegistryKey key=Registry.LocalMachine.OpenSubKey(@"Software\Bethesda Softworks\Morrowind"); sWidth=(int)key.GetValue("Screen Width"); sHeight=(int)key.GetValue("Screen Height"); Adaptor=DirectX.DXMain.Adapter; Fullscreen=!Windowed; key.Close(); //Get the list of valid resolutions Resolutions=DirectX.DXMain.GetResolutions(); //Show the dialog ResolutionForm rf=new ResolutionForm(); if(rf.ShowDialog()==DialogResult.OK) { //Write new data to the registry try { key = Registry.LocalMachine.OpenSubKey(@"Software\Bethesda Softworks\Morrowind", true); } catch { MessageBox.Show(Statics.strings["UnableToWriteReg"], Statics.strings["Error"]); } if (key != null) { key.SetValue("Screen Width", sWidth); key.SetValue("Screen Height", sHeight); key.Close(); } //Return p=new Point(sWidth, sHeight); return true; } p=new Point(); return false; }
public static bool ShowDialog(out Point p, out int refresh, bool Windowed) { // Fetch data from the registry RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Bethesda Softworks\Morrowind"); if (key != null) { sWidth = (int)key.GetValue("Screen Width", 1280); sHeight = (int)key.GetValue("Screen Height", 720); sRefresh = (int)key.GetValue("Refresh Rate", 0); key.Close(); } else { sWidth = 1280; sHeight = 720; sRefresh = 0; } Adaptor = DirectX.DXMain.Adapter; Fullscreen = !Windowed; // Get the list of valid resolutions Resolutions = new List <Resolution>(); foreach (Point r in DirectX.DXMain.GetResolutions()) { Resolutions.Add(new Resolution(r)); } Resolutions.Reverse(); // Show the dialog ResolutionForm rf = new ResolutionForm(); if (rf.ShowDialog() == DialogResult.OK) { // Write new data to the registry try { key = Registry.LocalMachine.OpenSubKey(@"Software\Bethesda Softworks\Morrowind", true); if (key == null) { throw new ArgumentNullException(); } key.SetValue("Screen Width", sWidth); key.SetValue("Screen Height", sHeight); key.SetValue("Refresh Rate", sRefresh); key.Close(); p = new Point(sWidth, sHeight); refresh = sRefresh; return(true); } catch { MessageBox.Show(Statics.strings["UnableToWriteReg"], Statics.strings["Error"]); } } p = new Point(); refresh = 0; return(false); }
public static bool ShowDialog(out Point p, bool Windowed) { //Fetch data from the registry RegistryKey key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind); sWidth=(int)key.GetValue("Screen Width"); sHeight=(int)key.GetValue("Screen Height"); Adaptor=DirectX.DXMain.Adapter; Fullscreen=!Windowed; key.Close(); //Show the dialog ResolutionForm rf=new ResolutionForm(); if(rf.ShowDialog()==DialogResult.OK) { p = new Point(sWidth, sHeight); SetResolution(p); // Write new dtat to the registry return true; } p=new Point(); return false; }