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

Commit 08dbc08

Browse files
authored
Merge pull request #67 from dhrdlicka/feature/dotnet-core-3.0
Fix some .NET Core 3.0 port bugs
2 parents 762960e + 6b3a084 commit 08dbc08

File tree

7 files changed

+76
-8
lines changed

7 files changed

+76
-8
lines changed

86BoxManager/FolderSelectDialog.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETCOREAPP // Not required for .NET Core builds
2+
using System;
23
using System.Reflection;
34
using System.Windows.Forms;
45

@@ -50,7 +51,7 @@ private static class VistaDialog
5051
private readonly static Assembly s_windowsFormsAssembly = typeof(FileDialog).Assembly;
5152
private readonly static Type s_iFileDialogType = s_windowsFormsAssembly.GetType("System.Windows.Forms.FileDialogNative+IFileDialog");
5253
private readonly static MethodInfo s_createVistaDialogMethodInfo = typeof(OpenFileDialog).GetMethod("CreateVistaDialog", c_flags);
53-
private readonly static MethodInfo s_onBeforeVistaDialogMethodInfo = typeof(OpenFileDialog).GetMethod("OnBeforeVistaDialog", c_flags);
54+
private readonly static MethodInfo s_onBeforeVistaDialogMethodInfo = typeof(FileDialog).GetMethod("OnBeforeVistaDialog", c_flags);
5455
private readonly static MethodInfo s_getOptionsMethodInfo = typeof(FileDialog).GetMethod("GetOptions", c_flags);
5556
private readonly static MethodInfo s_setOptionsMethodInfo = s_iFileDialogType.GetMethod("SetOptions", c_flags);
5657
private readonly static uint s_fosPickFoldersBitFlag = (uint)s_windowsFormsAssembly
@@ -107,4 +108,5 @@ private class WindowWrapper : IWin32Window
107108
public IntPtr Handle { get { return _handle; } }
108109
}
109110
}
110-
}
111+
}
112+
#endif

86BoxManager/dlgAbout.Designer.cs

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

86BoxManager/dlgAddVM.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,25 @@ private void txtName_TextChanged(object sender, EventArgs e)
7474
}
7575
}
7676

77+
// .NET Core implements the better Vista-style folder browse dialog in the stock FolderBrowserDialog
78+
#if NETCOREAPP
79+
private void btnBrowse_Click(object sender, EventArgs e)
80+
{
81+
FolderBrowserDialog dialog = new FolderBrowserDialog
82+
{
83+
RootFolder = Environment.SpecialFolder.MyComputer,
84+
Description = "Select a folder where your virtual machines (configs, nvr folders, etc.) will be located",
85+
UseDescriptionForTitle = true
86+
};
87+
88+
if (dialog.ShowDialog() == DialogResult.OK)
89+
{
90+
txtImportPath.Text = dialog.SelectedPath;
91+
txtName.Text = Path.GetFileName(dialog.SelectedPath);
92+
}
93+
}
94+
// A custom class is required for Vista-style folder dialogs under the original .NET Framework
95+
#else
7796
private void btnBrowse_Click(object sender, EventArgs e)
7897
{
7998
FolderSelectDialog dialog = new FolderSelectDialog
@@ -88,6 +107,7 @@ private void btnBrowse_Click(object sender, EventArgs e)
88107
txtName.Text = Path.GetFileName(dialog.FileName);
89108
}
90109
}
110+
#endif
91111

92112
private void cbxImport_CheckedChanged(object sender, EventArgs e)
93113
{

86BoxManager/dlgSettings.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,47 @@ private void LoadSettings()
235235
}
236236
}
237237

238+
// .NET Core implements the better Vista-style folder browse dialog in the stock FolderBrowserDialog
239+
#if NETCOREAPP
240+
private void btnBrowse1_Click(object sender, EventArgs e)
241+
{
242+
FolderBrowserDialog dialog = new FolderBrowserDialog
243+
{
244+
RootFolder = Environment.SpecialFolder.MyComputer,
245+
Description = "Select a folder where 86Box program files and the roms folder are located",
246+
UseDescriptionForTitle = true
247+
};
248+
249+
if (dialog.ShowDialog() == DialogResult.OK)
250+
{
251+
txtEXEdir.Text = dialog.SelectedPath;
252+
if (!txtEXEdir.Text.EndsWith(@"\")) //Just in case
253+
{
254+
txtEXEdir.Text += @"\";
255+
}
256+
}
257+
}
258+
259+
private void btnBrowse2_Click(object sender, EventArgs e)
260+
{
261+
FolderBrowserDialog dialog = new FolderBrowserDialog
262+
{
263+
RootFolder = Environment.SpecialFolder.MyComputer,
264+
Description = "Select a folder where your virtual machines (configs, nvr folders, etc.) will be located",
265+
UseDescriptionForTitle = true
266+
};
267+
268+
if (dialog.ShowDialog() == DialogResult.OK)
269+
{
270+
txtCFGdir.Text = dialog.SelectedPath;
271+
if (!txtCFGdir.Text.EndsWith(@"\")) //Just in case
272+
{
273+
txtCFGdir.Text += @"\";
274+
}
275+
}
276+
}
277+
// A custom class is required for Vista-style folder dialogs under the original .NET Framework
278+
#else
238279
private void btnBrowse1_Click(object sender, EventArgs e)
239280
{
240281
FolderSelectDialog dialog = new FolderSelectDialog
@@ -270,6 +311,7 @@ private void btnBrowse2_Click(object sender, EventArgs e)
270311
}
271312
}
272313
}
314+
#endif
273315

274316
private void btnDefaults_Click(object sender, EventArgs e)
275317
{

86BoxManager/frmMain.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETFRAMEWORK
1+
#if !NETCOREAPP // COM references require .NET framework for now
22
using IWshRuntimeLibrary;
33
#endif
44
using Microsoft.Win32;
@@ -52,8 +52,8 @@ public frmMain()
5252
LoadSettings();
5353
LoadVMs();
5454

55-
#if !NETFRAMEWORK
56-
createADesktopShortcutToolStripMenuItem.Enabled = false;
55+
#if NETCOREAPP
56+
createADesktopShortcutToolStripMenuItem.Enabled = false; // Requires the original .NET framework
5757
#endif
5858
}
5959

@@ -1136,7 +1136,7 @@ private void VMOpenFolder()
11361136

11371137
private void createADesktopShortcutToolStripMenuItem_Click(object sender, EventArgs e)
11381138
{
1139-
#if NETFRAMEWORK
1139+
#if !NETCOREAPP // Requires the original .NET Framework
11401140
VM vm = (VM)lstVMs.SelectedItems[0].Tag;
11411141
WshShell shell = new WshShell();
11421142
string shortcutAddress = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\" + vm.Name + ".lnk";

86BoxManagerCore/86BoxManagerCore.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1010
<AssemblyName>86Manager</AssemblyName>
11+
12+
<ApplicationIcon>..\86BoxManager\Resources\86Box.ico</ApplicationIcon>
1113
</PropertyGroup>
1214

1315
<ItemGroup>

AUTHORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ The following individuals or organizations have contributed at least some code t
22

33
David Simunič (@daviunic)
44
David Lee (@DL444)
5-
FolderSelectDialog class by ErikE from stackOverflow
5+
FolderSelectDialog class by ErikE from stackOverflow
6+
David Hrdlička (@dhrdlicka)

0 commit comments

Comments
 (0)