diff --git a/docs/Manual.md b/docs/Manual.md index 5251595..cf843ae 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -262,11 +262,6 @@ Can be suppressed via shift key. Default: yes ### General -#### --update-check=\ - -Daily check for new version. (requires PowerShell 5 and curl.) Default: no - - #### --process-instance=\ Defines if more then one mpv.net process is allowed. @@ -1381,13 +1376,6 @@ Shows the [mpv.net web site](https://mpv-net.github.io/mpv.net-web-site/). 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 Shows the mpv.net about dialog which shows a copyright notice, the versions of mpv.net and libmpv and a license notice (GPL v2). diff --git a/src/Misc/App.cs b/src/Misc/App.cs index 649ee86..bf9b2e6 100644 --- a/src/Misc/App.cs +++ b/src/Misc/App.cs @@ -28,7 +28,6 @@ namespace mpvnet public static bool Queue { get; set; } public static bool RememberVolume { get; set; } = true; public static bool RememberWindowPosition { get; set; } - public static bool UpdateCheck { get; set; } public static int StartThreshold { get; set; } = 1500; public static int RecentCount { get; set; } = 15; @@ -237,7 +236,6 @@ namespace mpvnet case "remember-window-position": RememberWindowPosition = value == "yes"; return true; case "start-size": StartSize = value; return true; case "start-threshold": StartThreshold = value.ToInt(); return true; - case "update-check": UpdateCheck = value == "yes"; return true; case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; default: if (writeError) diff --git a/src/Misc/Commands.cs b/src/Misc/Commands.cs index 29e528e..f65b825 100644 --- a/src/Misc/Commands.cs +++ b/src/Misc/Commands.cs @@ -54,7 +54,6 @@ namespace mpvnet case "show-protocols": ShowTextWithEditor("protocol-list", mpvHelp.GetProtocols()); break; case "show-recent": ShowRecent(); break; case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break; - case "update-check": UpdateCheck.CheckOnline(true); break; case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break; default: Terminal.WriteError($"No command '{id}' found."); break; diff --git a/src/Misc/MainForm.cs b/src/Misc/MainForm.cs index 70a0d62..e3514a4 100644 --- a/src/Misc/MainForm.cs +++ b/src/Misc/MainForm.cs @@ -1052,7 +1052,6 @@ namespace mpvnet Core.LoadScripts(); GlobalHotkey.RegisterGlobalHotkeys(Handle); App.RunTask(() => App.Extension = new Extension()); - UpdateCheck.DailyCheck(); App.RunTask(() => App.CopyMpvnetCom()); CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs"); WasShown = true; diff --git a/src/Misc/UpdateCheck.cs b/src/Misc/UpdateCheck.cs deleted file mode 100644 index fabdab8..0000000 --- a/src/Misc/UpdateCheck.cs +++ /dev/null @@ -1,85 +0,0 @@ - -using System; -using System.Diagnostics; -using System.IO; -using System.Net.Http; -using System.Reflection; -using System.Text.RegularExpressions; -using System.Windows.Forms; - -using static mpvnet.Global; - -namespace mpvnet -{ - class UpdateCheck - { - public static void DailyCheck() - { - if (App.UpdateCheck && App.Settings.LastUpdateCheck != DateTime.Now.DayOfYear) - CheckOnline(); - } - - public static async void CheckOnline(bool showUpToDateMessage = false) - { - try - { - using (HttpClient client = new HttpClient()) - { - App.Settings.LastUpdateCheck = DateTime.Now.DayOfYear; - client.DefaultRequestHeaders.Add("User-Agent", "mpv.net"); - 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-([\d\.]+)-portable\.zip"""); - - if (!match.Success) - { - App.InvokeOnMainThread(() => App.ShowError("Update check is currently not available.")); - return; - } - - Version onlineVersion = Version.Parse(match.Groups[1].Value); - Version currentVersion = Assembly.GetEntryAssembly().GetName().Version; - - if (onlineVersion <= currentVersion) - { - if (showUpToDateMessage) - App.InvokeOnMainThread(() => Msg.ShowInfo($"{Application.ProductName} is up to date.")); - - return; - } - - if ((App.Settings.UpdateCheckVersion != onlineVersion.ToString() || - showUpToDateMessage) && Msg.ShowQuestion( - $"New version {onlineVersion} is available, update now?") == - System.Windows.MessageBoxResult.OK) - { - string url = $"https://github.com/stax76/mpv.net/releases/download/{onlineVersion}/mpv.net-{onlineVersion}-portable.zip"; - - using (Process proc = new Process()) - { - proc.StartInfo.UseShellExecute = true; - proc.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); - proc.StartInfo.FileName = "powershell.exe"; - proc.StartInfo.Arguments = $"-NoExit -NoProfile -ExecutionPolicy Bypass -File \"{Folder.Startup + "Setup\\update.ps1"}\" \"{url}\" \"{Folder.Startup.TrimEnd(Path.DirectorySeparatorChar)}\""; - - if (Folder.Startup.Contains("Program Files")) - proc.StartInfo.Verb = "runas"; - - proc.Start(); - } - - Core.Command("quit"); - } - - App.Settings.UpdateCheckVersion = onlineVersion.ToString(); - } - } - catch (Exception ex) - { - if (showUpToDateMessage) - App.ShowException(ex); - } - } - } -} diff --git a/src/Resources/editor_conf.txt b/src/Resources/editor_conf.txt index 85b9eee..51e1bbc 100644 --- a/src/Resources/editor_conf.txt +++ b/src/Resources/editor_conf.txt @@ -609,16 +609,6 @@ file = mpv filter = Input help = Number of key presses to generate per second on autorepeat. -[setting] -name = update-check -file = mpvnet -default = no -filter = General -help = Daily check for new version. (mpv.net specific option) - -option = yes -option = no - [setting] name = process-instance file = mpvnet diff --git a/src/Resources/input.conf.txt b/src/Resources/input.conf.txt index c36eafc..ab23015 100644 --- a/src/Resources/input.conf.txt +++ b/src/Resources/input.conf.txt @@ -179,7 +179,6 @@ _ ignore #menu: _ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Manual mpv _ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/docs/Manual.md #menu: Help > Manual mpv.net _ ignore #menu: Help > - -_ script-message mpv.net update-check #menu: Help > Check for Updates _ script-message mpv.net show-about #menu: Help > About mpv.net F1 script-message mpv.net show-command-palette #menu: Command Palette diff --git a/src/mpv.net.csproj b/src/mpv.net.csproj index b60751b..3dc6a61 100644 --- a/src/mpv.net.csproj +++ b/src/mpv.net.csproj @@ -149,7 +149,6 @@ -