diff --git a/Changelog.md b/Changelog.md index dcdd498..499951a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,11 @@ -- new: install via Scoop and Chocolatey added to readme/website (Restia666Ashdoll) +### + +- new: install via Scoop and Chocolatey added to readme/website (maintained by Restia666Ashdoll) +- new: update check, it must be enabled first in the conf editor under General +- new: update feature, requires PowerShell 5 and curl, + an up to date Windows 10 system has both included. + Main menu (input.conf) must be reset or updated manually ([defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt)) - fix: often the OSC was shown when fullscreen was entered or on app startup, this is now suppressed diff --git a/LICENSE.txt b/LICENSE.txt index f1ca7dd..c1559bd 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,7 +1,7 @@ MIT License -Copyright 2002-2017 Frank Skare (stax76) +Copyright (c) 2002-2017 Frank Skare (stax76) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and ssociated documentation diff --git a/Manual.md b/Manual.md index d2265ef..62b7ada 100644 --- a/Manual.md +++ b/Manual.md @@ -85,6 +85,7 @@ + [Help > Show mpv default keys](#help--show-mpv-default-keys) + [Help > Show mpv.net default keys](#help--show-mpvnet-default-keys) + [Help > Show mpv.net manual](#help--show-mpvnet-manual) + + [Help > Check for Updates](#help--check-for-updates) + [Help > About mpv.net](#help--about-mpvnet) + [Exit](#exit) + [Exit Watch Later](#exit-watch-later) @@ -765,11 +766,7 @@ Cycles the hwdec property to enable/disable hardware decoding using the followin [hwdec property](https://mpv.io/manual/master/#options-hwdec) -### Tools > Execute mpv command - -Allows to execute mpv commands. - -### Tools > Manage File Associations +### Tools > OS Setup Allows to manage file associations. @@ -777,21 +774,19 @@ Allows to manage file associations. Shows the [mpv manual](https://mpv.io/manual/stable/). -### Help > Show mpv default keys +### Help > Show mpv.net web site -Shows the [mpv default keys](https://github.com/mpv-player/mpv/blob/master/etc/input.conf) - -### Help > Show mpv.net default keys - -Shows the [mpv.net default keys](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt) - -Help > Show mpv.net web site - -Shows the [mpv.net web site](https://mpv-net.github.io/mpv.net-web-site/) +Shows the [mpv.net web site](https://mpv-net.github.io/mpv.net-web-site/). ### Help > Show mpv.net manual -Shows the [mpv.net manual](https://github.com/stax76/mpv.net/blob/master/Manual.md) +Shows the [mpv.net manual](https://github.com/stax76/mpv.net/blob/master/Manual.md). + +### Help > Check for Updates + +Checks for updates and allows to execute the update routine. + +The update routine requires PowerShell 5 and curl, an up to date Windows 10 system has both included. ### Help > About mpv.net diff --git a/mpv.net/Misc/UpdateCheck.cs b/mpv.net/Misc/UpdateCheck.cs index efc1f2e..1d4be83 100644 --- a/mpv.net/Misc/UpdateCheck.cs +++ b/mpv.net/Misc/UpdateCheck.cs @@ -1,7 +1,6 @@  using System; using System.Diagnostics; -using System.IO; using System.Net.Http; using System.Reflection; using System.Text.RegularExpressions; @@ -30,41 +29,34 @@ namespace mpvnet var response = await client.GetAsync("https://api.github.com/repos/stax76/mpv.net/releases/latest"); response.EnsureSuccessStatusCode(); string content = await response.Content.ReadAsStringAsync(); - Match match = Regex.Match(content, $@"""mpv\.net-portable-x64-([\d\.]+)\.7z"""); + Match match = Regex.Match(content, @"""mpv\.net-portable-x64-([\d\.]+)\.7z"""); Version onlineVersion = Version.Parse(match.Groups[1].Value); Version currentVersion = Assembly.GetEntryAssembly().GetName().Version; - //if (onlineVersion == currentVersion) - //{ - // if (showUpToDateMessage) - // Msg.Show($"{Application.ProductName} is up to date."); - // return; - //} + if (onlineVersion == currentVersion) + { + if (showUpToDateMessage) + Msg.Show($"{Application.ProductName} is up to date."); + return; + } if (Msg.ShowQuestion($"New version {onlineVersion} is available, update now?") == MsgResult.OK) { string arch = IntPtr.Size == 8 ? "64" : "86"; string url = $"https://github.com/stax76/mpv.net/releases/download/{onlineVersion}/mpv.net-portable-x{arch}-{onlineVersion}.7z"; - bool asAdmin = false; - try { - File.WriteAllText(Folder.Startup + @"write access test", ""); - } catch { - asAdmin = true; + using (Process proc = new Process()) + { + proc.StartInfo.FileName = "PowerShell"; + proc.StartInfo.Arguments = $"-NoLogo -NoExit -File \"{Folder.Startup + "Update.ps1"}\" \"{url}\" \"{Application.StartupPath}\""; + + if (Folder.Startup.Contains("Program Files")) + proc.StartInfo.Verb = "runas"; + + proc.Start(); } - //using (Process proc = new Process()) - //{ - // proc.StartInfo.FileName = "PowerShell"; - // proc.StartInfo.Arguments = $"-File \"{Folder.Startup + "Update.ps1"}\" \"{url}\" \"{Application.StartupPath}\""; - - // if (asAdmin) - // proc.StartInfo.Verb = "runas"; - - // proc.Start(); - //} - - //mp.command("quit"); + mp.command("quit"); } } } diff --git a/mpv.net/Resources/ConfToml.txt b/mpv.net/Resources/ConfToml.txt index f6c5a20..b6aecb1 100644 --- a/mpv.net/Resources/ConfToml.txt +++ b/mpv.net/Resources/ConfToml.txt @@ -507,7 +507,7 @@ name = "update-check" file = "mpvnet" default = "no" filter = "General" -help = "Daily check for new version. (mpv.net specific setting)" +help = "Daily check for new version. (requires PowerShell 5 and curl. mpv.net specific setting)" options = [{ name = "yes" }, { name = "no" }] diff --git a/mpv.net/mpv.net.csproj b/mpv.net/mpv.net.csproj index 5b990df..10deecc 100644 --- a/mpv.net/mpv.net.csproj +++ b/mpv.net/mpv.net.csproj @@ -218,15 +218,12 @@ Changelog.md - PreserveNewest Manual.md - PreserveNewest README.md - PreserveNewest diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 0ef96e7..9cae186 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -152,7 +152,7 @@ namespace mpvnet get { if (_ConfigFolder == null) { - string portableFolder = Folder.Startup + "portable_config\\"; + string portableFolder = Folder.Startup + @"portable_config\"; _ConfigFolder = portableFolder; if (!Directory.Exists(_ConfigFolder)) @@ -160,15 +160,13 @@ namespace mpvnet if (!Directory.Exists(_ConfigFolder)) { - string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv.net\\"; - string appdataFolderMpv = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\"; + string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\mpv.net\"; using (TaskDialog td = new TaskDialog()) { td.MainInstruction = "Choose a settings folder."; td.AddCommandLink(@"AppData\Roaming\mpv.net", appdataFolder, appdataFolder); - td.AddCommandLink(@"AppData\Roaming\mpv", appdataFolderMpv, appdataFolderMpv); - td.AddCommandLink("\\portable_config", portableFolder, portableFolder); + td.AddCommandLink(@"\portable_config", portableFolder, portableFolder); td.AddCommandLink("Choose custom folder", "custom"); _ConfigFolder = td.Show(); } @@ -186,7 +184,7 @@ namespace mpvnet d.Description = "Choose a folder."; if (d.ShowDialog() == WinForms.DialogResult.OK) - _ConfigFolder = d.SelectedPath + "\\"; + _ConfigFolder = d.SelectedPath + @"\"; else _ConfigFolder = appdataFolder; }