diff --git a/Changelog.md b/Changelog.md
index f036d25..64674d3 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -5,7 +5,7 @@
- Load AviSynth DLL from environment variable AviSynthDLL
in order to support AviSynth portable mode.
- New option global-media-keys (next, previous, play/pause, stop).
-- Improved setup dialog.
+- Redesigned PowerShell based setup and setup dialog.
- Whenever there is a new startup location, the setup dialog is shown.
- libmpv updated to shinshiro 2020-11-22.
diff --git a/mpv.net/WPF/SetupWindow.xaml b/mpv.net/WPF/SetupWindow.xaml
index ef27e38..26eadc6 100644
--- a/mpv.net/WPF/SetupWindow.xaml
+++ b/mpv.net/WPF/SetupWindow.xaml
@@ -55,7 +55,7 @@
-
+
diff --git a/mpv.net/WPF/SetupWindow.xaml.cs b/mpv.net/WPF/SetupWindow.xaml.cs
index 3a5a830..ffb0d88 100644
--- a/mpv.net/WPF/SetupWindow.xaml.cs
+++ b/mpv.net/WPF/SetupWindow.xaml.cs
@@ -71,30 +71,12 @@ namespace mpvnet
void AddToPathEnvVar_Click(object sender, RoutedEventArgs e)
{
- string var = Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";";
- string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
-
- if (path.Contains(var))
- Msg.ShowWarning("Path was already containing mpv.net.");
- else
- {
- Environment.SetEnvironmentVariable("Path", var + path, EnvironmentVariableTarget.User);
- Msg.Show("mpv.net was successfully added to Path.", (var + path).Replace(";","\n"));
- }
+ ExecutePowerShellScript(Folder.Startup + "Setup\\add environment variable.ps1");
}
void RemoveFromPathEnvVar_Click(object sender, RoutedEventArgs e)
{
- string var = Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";";
- string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User);
-
- if (path.Contains(var))
- {
- Environment.SetEnvironmentVariable("Path", path.Replace(var, ""), EnvironmentVariableTarget.User);
- Msg.Show("mpv.net was successfully removed from Path.");
- }
- else
- Msg.ShowWarning("Path was not containing mpv.net.");
+ ExecutePowerShellScript(Folder.Startup + "Setup\\remove environment variable.ps1");
}
void AddStartMenuShortcut_Click(object sender, RoutedEventArgs e)
@@ -117,7 +99,7 @@ namespace mpvnet
ProcessHelp.Execute("powershell.exe", "-NoLogo -NoExit -ExecutionPolicy Bypass -File \"" + file + "\"");
}
- private void EditDefaultApp_Click(object sender, RoutedEventArgs e)
+ void EditDefaultApp_Click(object sender, RoutedEventArgs e)
{
ProcessHelp.ShellExecute("ms-settings:defaultapps");
}
diff --git a/setup.iss b/setup.iss
index 3513d05..1e1ca6c 100644
--- a/setup.iss
+++ b/setup.iss
@@ -42,3 +42,4 @@ Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesub
[UninstallRun]
Filename: "powershell.exe"; Flags: runhidden; Parameters: "-ExecutionPolicy Bypass -File ""{app}\Setup\remove file associations.ps1"""
Filename: "powershell.exe"; Flags: runhidden; Parameters: "-ExecutionPolicy Bypass -File ""{app}\Setup\remove start menu shortcut.ps1"""
+Filename: "powershell.exe"; Flags: runhidden; Parameters: "-ExecutionPolicy Bypass -File ""{app}\Setup\remove environment variable.ps1"""