Auto update feature removed

This commit is contained in:
stax76
2021-11-14 00:05:31 +01:00
parent 4efe85aad7
commit 243b45326e
8 changed files with 0 additions and 113 deletions

View File

@@ -262,11 +262,6 @@ Can be suppressed via shift key. Default: yes
### General
#### --update-check=\<yes|no\>
Daily check for new version. (requires PowerShell 5 and curl.) Default: no
#### --process-instance=\<value\>
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).

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
}
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -149,7 +149,6 @@
<Compile Include="Misc\Msg.cs" />
<Compile Include="Misc\Settings.cs" />
<Compile Include="Misc\Terminal.cs" />
<Compile Include="Misc\UpdateCheck.cs" />
<Compile Include="Misc\Theme.cs" />
<Compile Include="Misc\PowerShell.cs" />
<Compile Include="Native\StockIcon.cs" />