diff --git a/docs/changelog.md b/docs/changelog.md index b714537..e5e05cb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,6 +1,9 @@ -# v7.0.0.4 Beta (2023-??-??) +# v7.0.0.4 Beta (2023-12-19) +- When mpv.net is started for the first time from a new startup location, + it asks if file associations should be registered. +- Setup supports installing per user in non admin mode. - Command line parser supports list options with `-add` suffix. - Fix window sometimes shown with wrong size. - Limited support for the mpv option `geometry`, it supports location in percent, @@ -31,7 +34,8 @@ - Conf editor support added for the mpv options: `reset-on-next-file`, `input-ipc-server`, `background`, `title` - Conf editor crash fixed. -- When mpv.net is started for the first time from a new startup location, it asks if mpv.net should be added to the Path environment variable. +- When mpv.net is started for the first time from a new startup location, + it asks if mpv.net should be added to the Path environment variable. # v7.0.0.2 Beta (2023-12-13) diff --git a/src/MpvNet.Windows/Help/WinMpvHelp.cs b/src/MpvNet.Windows/Help/WinMpvHelp.cs index d6debeb..5379502 100644 --- a/src/MpvNet.Windows/Help/WinMpvHelp.cs +++ b/src/MpvNet.Windows/Help/WinMpvHelp.cs @@ -1,36 +1,58 @@  using System.Windows; - using MpvNet.Windows.WPF; namespace MpvNet.Windows.Help; public class WinMpvHelp { - public static void AddToPath() + public static void Setup() { - string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!; - - if (path.ToLower().Contains(Folder.Startup.TrimEnd(Path.DirectorySeparatorChar).ToLower())) - return; - - string dir = RegistryHelp.GetString("PathEnvVarCheck"); + string dir = RegistryHelp.GetString("PathEnvVarCheck"); // backward compatibility if (dir == Folder.Startup) return; - var result = Msg.ShowQuestion("Would you like to add mpv.net to the Path environment variable?", - MessageBoxButton.YesNo); + dir = RegistryHelp.GetString("Setup"); - if (result == MessageBoxResult.Yes) + if (dir == Folder.Startup) + return; + + string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!; + + if (!path.ToLower().Contains(Folder.Startup.TrimEnd(Path.DirectorySeparatorChar).ToLower())) { - Environment.SetEnvironmentVariable("Path", - Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";" + path, - EnvironmentVariableTarget.User); + var result = Msg.ShowQuestion("Would you like to add mpv.net to the Path environment variable?" + BR2 + + "This will allow using mpv.net in a console/terminal.", MessageBoxButton.YesNo); - Msg.ShowInfo("mpv.net was added successfully to Path."); + if (result == MessageBoxResult.Yes) + { + Environment.SetEnvironmentVariable("Path", + Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";" + path, + EnvironmentVariableTarget.User); + + Msg.ShowInfo("mpv.net was added successfully to Path."); + } + else + Msg.ShowInfo("If you want to add mpv.net to the Path environment variable later," + BR + + "you can do so with the context menu (Settings/Setup)"); } - RegistryHelp.SetString("PathEnvVarCheck", Folder.Startup); + var result2 = Msg.ShowQuestion("Would you like to register video file associations?", MessageBoxButton.YesNo); + + if (result2 == MessageBoxResult.Yes) + { + Player.Command("script-message-to mpvnet reg-file-assoc video"); + + result2 = Msg.ShowQuestion("Would you like to register audio file associations?", MessageBoxButton.YesNo); + + if (result2 == MessageBoxResult.Yes) + Player.Command("script-message-to mpvnet reg-file-assoc audio"); + } + else + Msg.ShowInfo("If you want to register file associations later," + BR + + "you can do so with the context menu (Settings/Setup)"); + + RegistryHelp.SetString("Setup", Folder.Startup); } } diff --git a/src/MpvNet.Windows/MpvNet.Windows.csproj b/src/MpvNet.Windows/MpvNet.Windows.csproj index 3346ff3..a7d0f8b 100644 --- a/src/MpvNet.Windows/MpvNet.Windows.csproj +++ b/src/MpvNet.Windows/MpvNet.Windows.csproj @@ -11,9 +11,9 @@ true mpv-icon.ico mpv.net - 7.0.0.3 - 7.0.0.3 - 7.0.0.3 + 7.0.0.4 + 7.0.0.4 + 7.0.0.4 enable diff --git a/src/MpvNet.Windows/WinForms/MainForm.cs b/src/MpvNet.Windows/WinForms/MainForm.cs index 6abca20..2d11763 100644 --- a/src/MpvNet.Windows/WinForms/MainForm.cs +++ b/src/MpvNet.Windows/WinForms/MainForm.cs @@ -1287,7 +1287,7 @@ public partial class MainForm : Form TaskHelp.Run(() => { System.Windows.Application.Current.Dispatcher.BeginInvoke(() => { - WinMpvHelp.AddToPath(); + WinMpvHelp.Setup(); }, DispatcherPriority.Background); }); } diff --git a/src/Setup/Inno/inno-setup.iss b/src/Setup/Inno/inno-setup.iss index 980c68e..6cb0a73 100644 --- a/src/Setup/Inno/inno-setup.iss +++ b/src/Setup/Inno/inno-setup.iss @@ -11,12 +11,14 @@ AppVersion={#MyAppVersion} AppPublisher=Frank Skare (stax76) ArchitecturesInstallIn64BitMode=x64 Compression=lzma2 -DefaultDirName={commonpf}\{#MyAppName} +DefaultDirName={autopf}\{#MyAppName} OutputBaseFilename=mpv.net-v{#MyAppVersion}-setup OutputDir=E:\Desktop DefaultGroupName={#MyAppName} SetupIconFile=..\..\MpvNet.Windows\mpv-icon.ico UninstallDisplayIcon={app}\{#MyAppExeName} +PrivilegesRequired=admin +PrivilegesRequiredOverridesAllowed=dialog [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"