Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Commit 9093cf4

Browse files
committed
Final 1.3.3 commit
Made some final fixes for 1.3.3
1 parent 14152fb commit 9093cf4

File tree

4 files changed

+131
-154
lines changed

4 files changed

+131
-154
lines changed

86BoxManager/dlgSettings.cs

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ private void SaveSettings()
7777
{
7878
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\86Box");
7979
regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
80+
regkey.CreateSubKey("Virtual Machines");
8081
}
8182

8283
//Store the new values, close the key, changes are saved
@@ -113,8 +114,8 @@ private void LoadSettings()
113114
regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
114115
regkey.CreateSubKey("Virtual Machines");
115116

116-
txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\86Box VMs";
117-
txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box";
117+
txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\86Box VMs\";
118+
txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box\";
118119
cbxMinimize.Checked = false;
119120
cbxShowConsole.Checked = true;
120121
cbxMinimizeTray.Checked = false;
@@ -197,62 +198,60 @@ private void btnDefaults_Click(object sender, EventArgs e)
197198
//Resets the settings to their default values
198199
private void ResetSettings()
199200
{
200-
RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE", true);
201+
RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
201202

202-
if(regkey != null)
203+
if (regkey == null)
203204
{
204-
txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\86Box VMs\";
205-
txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box\";
206-
cbxMinimize.Checked = false;
207-
cbxShowConsole.Checked = true;
208-
cbxMinimizeTray.Checked = false;
209-
cbxCloseTray.Checked = false;
210-
211-
regkey.SetValue("EXEdir", txtEXEdir.Text, RegistryValueKind.String);
212-
regkey.SetValue("CFGdir", txtCFGdir.Text, RegistryValueKind.String);
213-
regkey.SetValue("MinimizeOnVMStart", cbxMinimize.Checked, RegistryValueKind.DWord);
214-
regkey.SetValue("ShowConsole", cbxShowConsole.Checked, RegistryValueKind.DWord);
215-
regkey.SetValue("MinimizeToTray", cbxMinimizeTray.Checked, RegistryValueKind.DWord);
216-
regkey.SetValue("CloseToTray", cbxCloseTray.Checked, RegistryValueKind.DWord);
205+
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\86Box");
206+
regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
207+
regkey.CreateSubKey("Virtual Machines");
217208
}
218209

210+
txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\86Box VMs\";
211+
txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box\";
212+
cbxMinimize.Checked = false;
213+
cbxShowConsole.Checked = true;
214+
cbxMinimizeTray.Checked = false;
215+
cbxCloseTray.Checked = false;
216+
217+
SaveSettings();
219218
regkey.Close();
220219
}
221220

222-
private void cbxCloseTray_CheckedChanged(object sender, EventArgs e)
221+
private void cbxCloseTray_CheckedChanged(object sender, EventArgs e)
222+
{
223+
settingsChanged = CheckForChanges();
224+
}
225+
226+
private void cbxMinimizeTray_CheckedChanged(object sender, EventArgs e)
227+
{
228+
settingsChanged = CheckForChanges();
229+
}
230+
231+
//Checks if all controls match the currently saved settings to determine if any changes were made
232+
private bool CheckForChanges()
233+
{
234+
RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box");
235+
236+
try
223237
{
224-
settingsChanged = CheckForChanges();
225-
}
238+
btnApply.Enabled = (txtEXEdir.Text != regkey.GetValue("EXEdir").ToString() ||
239+
txtCFGdir.Text != regkey.GetValue("CFGdir").ToString() ||
240+
cbxMinimize.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart")) ||
241+
cbxShowConsole.Checked != Convert.ToBoolean(regkey.GetValue("ShowConsole")) ||
242+
cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) ||
243+
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")));
226244

227-
private void cbxMinimizeTray_CheckedChanged(object sender, EventArgs e)
245+
return btnApply.Enabled;
246+
}
247+
catch (Exception ex)
228248
{
229-
settingsChanged = CheckForChanges();
249+
return true; //For now let's just return true if anything goes wrong
230250
}
231-
232-
//Checks if all controls match the currently saved settings to determine if any changes were made
233-
private bool CheckForChanges()
251+
finally
234252
{
235-
RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box");
236-
237-
try
238-
{
239-
btnApply.Enabled = (txtEXEdir.Text != regkey.GetValue("EXEdir").ToString() ||
240-
txtCFGdir.Text != regkey.GetValue("CFGdir").ToString() ||
241-
cbxMinimize.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart")) ||
242-
cbxShowConsole.Checked != Convert.ToBoolean(regkey.GetValue("ShowConsole")) ||
243-
cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) ||
244-
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")));
245-
246-
return btnApply.Enabled;
247-
}
248-
catch(Exception ex)
249-
{
250-
return true; //For now let's just return true if anything goes wrong
251-
}
252-
finally
253-
{
254-
regkey.Close();
255-
}
253+
regkey.Close();
256254
}
257255
}
258256
}
257+
}

86BoxManager/frmMain.Designer.cs

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

86BoxManager/frmMain.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private void LoadSettings()
203203
minimizeTray = Convert.ToBoolean(regkey.GetValue("MinimizeToTray"));
204204
closeTray = Convert.ToBoolean(regkey.GetValue("CloseToTray"));
205205
}
206-
catch(Exception ex)
206+
catch (Exception ex)
207207
{
208208
MessageBox.Show("86Box Manager settings could not be loaded. This is normal if you're running 86Box Manager for the first time. Default values will be used.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
209209

@@ -212,10 +212,11 @@ private void LoadSettings()
212212
{
213213
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\86Box");
214214
regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
215+
regkey.CreateSubKey("Virtual Machines");
215216
}
216-
217+
217218
cfgpath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\86Box VMs\";
218-
exepath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box\";
219+
exepath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box\";
219220
minimize = false;
220221
showConsole = true;
221222
minimizeTray = false;
@@ -228,12 +229,10 @@ private void LoadSettings()
228229
regkey.SetValue("ShowConsole", showConsole, RegistryValueKind.DWord);
229230
regkey.SetValue("MinimizeToTray", minimizeTray, RegistryValueKind.DWord);
230231
regkey.SetValue("CloseToTray", closeTray, RegistryValueKind.DWord);
231-
232-
regkey.CreateSubKey("Virtual Machines");
233232
}
234233
finally
235234
{
236-
//To make sure there's a trailing backslash at the end, as other cude using these strings expects it!
235+
//To make sure there's a trailing backslash at the end, as other code using these strings expects it!
237236
if (!exepath.EndsWith(@"\"))
238237
{
239238
exepath += @"\";
@@ -447,7 +446,7 @@ private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
447446
}
448447
Thread.Sleep(1000); //Wait just a bit to make sure everything goes as planned
449448
}
450-
else if(DialogResult == DialogResult.Cancel)
449+
else if (DialogResult == DialogResult.Cancel)
451450
{
452451
return;
453452
}
@@ -556,7 +555,7 @@ private void VMStart()
556555
}
557556
}
558557
}
559-
catch(Win32Exception ex)
558+
catch (Win32Exception ex)
560559
{
561560
MessageBox.Show("Cannot find 86Box.exe. Make sure your settings are correct and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
562561
}
@@ -876,7 +875,7 @@ private void VMRemove()
876875
{
877876
Directory.Delete(cfgpath + vm.Name, true);
878877
}
879-
catch (DirectoryNotFoundException){/*Just ignore this for now*/}
878+
catch (DirectoryNotFoundException) {/*Just ignore this for now*/}
880879
MessageBox.Show("Virtual machine \"" + vm.Name + "\" was successfully removed, along with its files.", "Virtual machine and files removed", MessageBoxButtons.OK, MessageBoxIcon.Information);
881880
}
882881
}
@@ -1019,7 +1018,7 @@ protected override void WndProc(ref Message m)
10191018
ListViewItem lvi = lstVMs.FindItemWithText(ds.Data);
10201019

10211020
//This check is necessary in case the specified VM was already removed but the shortcut remains
1022-
if(lvi != null)
1021+
if (lvi != null)
10231022
{
10241023
VM vm = (VM)lvi.Tag;
10251024

@@ -1128,7 +1127,7 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e)
11281127
}
11291128
Thread.Sleep(1000); //Wait just a bit to make sure everything goes as planned
11301129
}
1131-
else if(DialogResult == DialogResult.Cancel)
1130+
else if (DialogResult == DialogResult.Cancel)
11321131
{
11331132
return;
11341133
}

0 commit comments

Comments
 (0)