update check and update routine
This commit is contained in:
@@ -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
|
- fix: often the OSC was shown when fullscreen was entered
|
||||||
or on app startup, this is now suppressed
|
or on app startup, this is now suppressed
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and ssociated documentation
|
obtaining a copy of this software and ssociated documentation
|
||||||
|
|||||||
27
Manual.md
27
Manual.md
@@ -85,6 +85,7 @@
|
|||||||
+ [Help > Show mpv default keys](#help--show-mpv-default-keys)
|
+ [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 default keys](#help--show-mpvnet-default-keys)
|
||||||
+ [Help > Show mpv.net manual](#help--show-mpvnet-manual)
|
+ [Help > Show mpv.net manual](#help--show-mpvnet-manual)
|
||||||
|
+ [Help > Check for Updates](#help--check-for-updates)
|
||||||
+ [Help > About mpv.net](#help--about-mpvnet)
|
+ [Help > About mpv.net](#help--about-mpvnet)
|
||||||
+ [Exit](#exit)
|
+ [Exit](#exit)
|
||||||
+ [Exit Watch Later](#exit-watch-later)
|
+ [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)
|
[hwdec property](https://mpv.io/manual/master/#options-hwdec)
|
||||||
|
|
||||||
### Tools > Execute mpv command
|
### Tools > OS Setup
|
||||||
|
|
||||||
Allows to execute mpv commands.
|
|
||||||
|
|
||||||
### Tools > Manage File Associations
|
|
||||||
|
|
||||||
Allows to manage file associations.
|
Allows to manage file associations.
|
||||||
|
|
||||||
@@ -777,21 +774,19 @@ Allows to manage file associations.
|
|||||||
|
|
||||||
Shows the [mpv manual](https://mpv.io/manual/stable/).
|
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)
|
Shows the [mpv.net web site](https://mpv-net.github.io/mpv.net-web-site/).
|
||||||
|
|
||||||
### 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/)
|
|
||||||
|
|
||||||
### Help > Show mpv.net manual
|
### 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
|
### Help > About mpv.net
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
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");
|
var response = await client.GetAsync("https://api.github.com/repos/stax76/mpv.net/releases/latest");
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
string content = await response.Content.ReadAsStringAsync();
|
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 onlineVersion = Version.Parse(match.Groups[1].Value);
|
||||||
Version currentVersion = Assembly.GetEntryAssembly().GetName().Version;
|
Version currentVersion = Assembly.GetEntryAssembly().GetName().Version;
|
||||||
|
|
||||||
//if (onlineVersion == currentVersion)
|
if (onlineVersion == currentVersion)
|
||||||
//{
|
{
|
||||||
// if (showUpToDateMessage)
|
if (showUpToDateMessage)
|
||||||
// Msg.Show($"{Application.ProductName} is up to date.");
|
Msg.Show($"{Application.ProductName} is up to date.");
|
||||||
// return;
|
return;
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (Msg.ShowQuestion($"New version {onlineVersion} is available, update now?") == MsgResult.OK)
|
if (Msg.ShowQuestion($"New version {onlineVersion} is available, update now?") == MsgResult.OK)
|
||||||
{
|
{
|
||||||
string arch = IntPtr.Size == 8 ? "64" : "86";
|
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";
|
string url = $"https://github.com/stax76/mpv.net/releases/download/{onlineVersion}/mpv.net-portable-x{arch}-{onlineVersion}.7z";
|
||||||
bool asAdmin = false;
|
|
||||||
|
|
||||||
try {
|
using (Process proc = new Process())
|
||||||
File.WriteAllText(Folder.Startup + @"write access test", "");
|
{
|
||||||
} catch {
|
proc.StartInfo.FileName = "PowerShell";
|
||||||
asAdmin = true;
|
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())
|
mp.command("quit");
|
||||||
//{
|
|
||||||
// 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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ name = "update-check"
|
|||||||
file = "mpvnet"
|
file = "mpvnet"
|
||||||
default = "no"
|
default = "no"
|
||||||
filter = "General"
|
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" },
|
options = [{ name = "yes" },
|
||||||
{ name = "no" }]
|
{ name = "no" }]
|
||||||
|
|
||||||
|
|||||||
@@ -218,15 +218,12 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="..\Changelog.md">
|
<None Include="..\Changelog.md">
|
||||||
<Link>Changelog.md</Link>
|
<Link>Changelog.md</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\Manual.md">
|
<None Include="..\Manual.md">
|
||||||
<Link>Manual.md</Link>
|
<Link>Manual.md</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\README.md">
|
<None Include="..\README.md">
|
||||||
<Link>README.md</Link>
|
<Link>README.md</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
</None>
|
||||||
<None Include="app.manifest" />
|
<None Include="app.manifest" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace mpvnet
|
|||||||
get {
|
get {
|
||||||
if (_ConfigFolder == null)
|
if (_ConfigFolder == null)
|
||||||
{
|
{
|
||||||
string portableFolder = Folder.Startup + "portable_config\\";
|
string portableFolder = Folder.Startup + @"portable_config\";
|
||||||
_ConfigFolder = portableFolder;
|
_ConfigFolder = portableFolder;
|
||||||
|
|
||||||
if (!Directory.Exists(_ConfigFolder))
|
if (!Directory.Exists(_ConfigFolder))
|
||||||
@@ -160,15 +160,13 @@ namespace mpvnet
|
|||||||
|
|
||||||
if (!Directory.Exists(_ConfigFolder))
|
if (!Directory.Exists(_ConfigFolder))
|
||||||
{
|
{
|
||||||
string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv.net\\";
|
string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\mpv.net\";
|
||||||
string appdataFolderMpv = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\";
|
|
||||||
|
|
||||||
using (TaskDialog<string> td = new TaskDialog<string>())
|
using (TaskDialog<string> td = new TaskDialog<string>())
|
||||||
{
|
{
|
||||||
td.MainInstruction = "Choose a settings folder.";
|
td.MainInstruction = "Choose a settings folder.";
|
||||||
td.AddCommandLink(@"AppData\Roaming\mpv.net", appdataFolder, appdataFolder);
|
td.AddCommandLink(@"AppData\Roaming\mpv.net", appdataFolder, appdataFolder);
|
||||||
td.AddCommandLink(@"AppData\Roaming\mpv", appdataFolderMpv, appdataFolderMpv);
|
td.AddCommandLink(@"<startup>\portable_config", portableFolder, portableFolder);
|
||||||
td.AddCommandLink("<startup>\\portable_config", portableFolder, portableFolder);
|
|
||||||
td.AddCommandLink("Choose custom folder", "custom");
|
td.AddCommandLink("Choose custom folder", "custom");
|
||||||
_ConfigFolder = td.Show();
|
_ConfigFolder = td.Show();
|
||||||
}
|
}
|
||||||
@@ -186,7 +184,7 @@ namespace mpvnet
|
|||||||
d.Description = "Choose a folder.";
|
d.Description = "Choose a folder.";
|
||||||
|
|
||||||
if (d.ShowDialog() == WinForms.DialogResult.OK)
|
if (d.ShowDialog() == WinForms.DialogResult.OK)
|
||||||
_ConfigFolder = d.SelectedPath + "\\";
|
_ConfigFolder = d.SelectedPath + @"\";
|
||||||
else
|
else
|
||||||
_ConfigFolder = appdataFolder;
|
_ConfigFolder = appdataFolder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user