diff --git a/ZuneModCore/Mod.cs b/ZuneModCore/Mod.cs index 75a25fc..a1eb6c2 100644 --- a/ZuneModCore/Mod.cs +++ b/ZuneModCore/Mod.cs @@ -20,7 +20,7 @@ namespace ZuneModCore new MbidLocatorMod(), }.AsReadOnly(); - public static string ZuneInstallDir { get; set; } = @"C:\Program Files\Zune\"; + public static string ZuneInstallDir { get; set; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Zune"); public abstract string Id { get; } diff --git a/ZuneModdingHelper/MainWindow.xaml.cs b/ZuneModdingHelper/MainWindow.xaml.cs index a98b1e3..13bb110 100644 --- a/ZuneModdingHelper/MainWindow.xaml.cs +++ b/ZuneModdingHelper/MainWindow.xaml.cs @@ -3,6 +3,7 @@ using Flurl.Http; using MahApps.Metro.Controls; using MahApps.Metro.Controls.Dialogs; using Microsoft.AppCenter.Analytics; +using Microsoft.WindowsAPICodePack.Dialogs; using Newtonsoft.Json.Linq; using OwlCore.AbstractUI.ViewModels; using System; @@ -27,7 +28,7 @@ namespace ZuneModdingHelper ColorScheme = MetroDialogColorScheme.Accented, AnimateShow = true, AnimateHide = true, - AffirmativeButtonText = "Close" + AffirmativeButtonText = "OK" }; public MainWindow() @@ -245,7 +246,26 @@ namespace ZuneModdingHelper private void LocateZuneButton_Click(object sender, RoutedEventArgs e) { - + if (CommonFileDialog.IsPlatformSupported) + { + CommonOpenFileDialog dialog = new() + { + IsFolderPicker = true, + DefaultFileName = Mod.ZuneInstallDir + }; + CommonFileDialogResult result = dialog.ShowDialog(); + if (result == CommonFileDialogResult.Ok) + { + ZuneInstallDirBox.Text = dialog.FileName; + } + } + else + { + // TODO: Fallback to pre-Vista dialog + this.ShowMessageAsync("Error", + "Please use File Explorer to locate an copy the path.", + settings: defaultMetroDialogSettings); + } } } } diff --git a/ZuneModdingHelper/ZuneModdingHelper.csproj b/ZuneModdingHelper/ZuneModdingHelper.csproj index 5a06cc0..57d726f 100644 --- a/ZuneModdingHelper/ZuneModdingHelper.csproj +++ b/ZuneModdingHelper/ZuneModdingHelper.csproj @@ -1,28 +1,29 @@  - - WinExe - net5.0-windows - true - app.manifest - 2021.8.4.0 - Joshua "Yoshi" Askharoun - https://github.com/ZuneDev/ZuneModdingHelper - git - x64;x86 - + + WinExe + net5.0-windows + true + app.manifest + 2021.8.4.0 + Joshua "Yoshi" Askharoun + https://github.com/ZuneDev/ZuneModdingHelper + git + x64;x86 + - - - + + + - - - - - - - - + + + + + + + + +