changelog and update check
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
|
||||
- new: install via Scoop and Chocolatey added to readme/website (Restia666Ashdoll)
|
||||
|
||||
- fix: often the OSC was shown when fullscreen was entered
|
||||
or on app startup, this is now suppressed
|
||||
|
||||
### 5.4.3.0
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace mpvnet
|
||||
public static bool RememberVolume { get; set; } = true;
|
||||
public static bool AutoLoadFolder { get; set; } = true;
|
||||
public static bool Queue { get; set; }
|
||||
public static bool UpdateCheck { get; set; }
|
||||
|
||||
public static int StartThreshold { get; set; } = 1500;
|
||||
public static int RecentCount { get; set; } = 15;
|
||||
@@ -83,8 +84,8 @@ namespace mpvnet
|
||||
{
|
||||
if (RememberVolume)
|
||||
{
|
||||
mp.set_property_int("volume", RegHelp.GetInt(App.RegPath, "Volume", 70));
|
||||
mp.set_property_string("mute", RegHelp.GetString(App.RegPath, "Mute", "no"));
|
||||
mp.set_property_int("volume", RegistryHelp.GetInt(App.RegPath, "Volume", 70));
|
||||
mp.set_property_string("mute", RegistryHelp.GetString(App.RegPath, "Mute", "no"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +93,8 @@ namespace mpvnet
|
||||
{
|
||||
if (RememberVolume)
|
||||
{
|
||||
RegHelp.SetObject(App.RegPath, "Volume", mp.get_property_int("volume"));
|
||||
RegHelp.SetObject(App.RegPath, "Mute", mp.get_property_string("mute"));
|
||||
RegistryHelp.SetValue(App.RegPath, "Volume", mp.get_property_int("volume"));
|
||||
RegistryHelp.SetValue(App.RegPath, "Mute", mp.get_property_string("mute"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,16 +121,17 @@ namespace mpvnet
|
||||
{
|
||||
case "remember-position": RememberPosition = value == "yes"; return true;
|
||||
case "maximized": Maximized = value == "yes"; return true;
|
||||
case "debug-mode": DebugMode = value == "yes"; return true;
|
||||
case "remember-volume": RememberVolume = value == "yes"; return true;
|
||||
case "queue": Queue = value == "yes"; return true;
|
||||
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
|
||||
case "update-check": UpdateCheck = value == "yes"; return true;
|
||||
case "start-size": RememberHeight = value == "previous"; return true;
|
||||
case "process-instance": ProcessInstance = value; return true;
|
||||
case "dark-mode": DarkMode = value; return true;
|
||||
case "debug-mode": DebugMode = value == "yes"; return true;
|
||||
case "remember-volume": RememberVolume = value == "yes"; return true;
|
||||
case "start-threshold": StartThreshold = value.Int(); return true;
|
||||
case "minimum-aspect-ratio": MinimumAspectRatio = value.Float(); return true;
|
||||
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
|
||||
case "recent-count": RecentCount = value.Int(); return true;
|
||||
case "queue": Queue = value == "yes"; return true;
|
||||
case "minimum-aspect-ratio": MinimumAspectRatio = value.Float(); return true;
|
||||
case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true;
|
||||
case "light-theme": LightTheme = value.Trim('\'', '"'); return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -17,6 +18,7 @@ namespace mpvnet
|
||||
switch (id)
|
||||
{
|
||||
case "open-files": OpenFiles(args); break;
|
||||
case "update-check": UpdateCheck.CheckOnline(true); break;
|
||||
case "open-url": OpenURL(); break;
|
||||
case "open-optical-media": Open_DVD_Or_BD_Folder(); break;
|
||||
case "manage-file-associations": // deprecated 2019
|
||||
@@ -201,9 +203,9 @@ namespace mpvnet
|
||||
public static void ExecuteMpvCommand() // deprecated 2019
|
||||
{
|
||||
InvokeOnMainThread(new Action(() => {
|
||||
string command = VB.Interaction.InputBox("Enter a mpv command to be executed.", "Execute Command", RegHelp.GetString(App.RegPath, "RecentExecutedCommand"));
|
||||
string command = VB.Interaction.InputBox("Enter a mpv command to be executed.", "Execute Command", RegistryHelp.GetString(App.RegPath, "RecentExecutedCommand"));
|
||||
if (string.IsNullOrEmpty(command)) return;
|
||||
RegHelp.SetObject(App.RegPath, "RecentExecutedCommand", command);
|
||||
RegistryHelp.SetValue(App.RegPath, "RecentExecutedCommand", command);
|
||||
mp.command(command, false);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -66,108 +66,52 @@ namespace mpvnet
|
||||
{
|
||||
Types = types;
|
||||
|
||||
RegHelp.SetObject(@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename, null, ExePath);
|
||||
RegHelp.SetObject(@"HKCR\Applications\" + ExeFilename, "FriendlyAppName", "mpv.net media player");
|
||||
RegHelp.SetObject($@"HKCR\Applications\{ExeFilename}\shell\open\command", null, $"\"{ExePath}\" \"%1\"");
|
||||
RegHelp.SetObject(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities", "ApplicationDescription", "mpv.net media player");
|
||||
RegHelp.SetObject(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities", "ApplicationName", "mpv.net");
|
||||
RegHelp.SetObject(@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename, null, "");
|
||||
RegHelp.SetObject(@"HKCR\SystemFileAssociations\audio\OpenWithList\" + ExeFilename, null, "");
|
||||
RegHelp.SetObject(@"HKLM\SOFTWARE\RegisteredApplications", "mpv.net", @"SOFTWARE\Clients\Media\mpv.net\Capabilities");
|
||||
RegistryHelp.SetValue(@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename, null, ExePath);
|
||||
RegistryHelp.SetValue(@"HKCR\Applications\" + ExeFilename, "FriendlyAppName", "mpv.net media player");
|
||||
RegistryHelp.SetValue($@"HKCR\Applications\{ExeFilename}\shell\open\command", null, $"\"{ExePath}\" \"%1\"");
|
||||
RegistryHelp.SetValue(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities", "ApplicationDescription", "mpv.net media player");
|
||||
RegistryHelp.SetValue(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities", "ApplicationName", "mpv.net");
|
||||
RegistryHelp.SetValue(@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename, null, "");
|
||||
RegistryHelp.SetValue(@"HKCR\SystemFileAssociations\audio\OpenWithList\" + ExeFilename, null, "");
|
||||
RegistryHelp.SetValue(@"HKLM\SOFTWARE\RegisteredApplications", "mpv.net", @"SOFTWARE\Clients\Media\mpv.net\Capabilities");
|
||||
|
||||
foreach (string ext in Types)
|
||||
{
|
||||
RegHelp.SetObject($@"HKCR\Applications\{ExeFilename}\SupportedTypes", "." + ext, "");
|
||||
RegHelp.SetObject($@"HKCR\" + "." + ext, null, ExeFilenameNoExt + "." + ext);
|
||||
RegHelp.SetObject($@"HKCR\" + "." + ext + @"\OpenWithProgIDs", ExeFilenameNoExt + "." + ext, "");
|
||||
RegistryHelp.SetValue($@"HKCR\Applications\{ExeFilename}\SupportedTypes", "." + ext, "");
|
||||
RegistryHelp.SetValue($@"HKCR\" + "." + ext, null, ExeFilenameNoExt + "." + ext);
|
||||
RegistryHelp.SetValue($@"HKCR\" + "." + ext + @"\OpenWithProgIDs", ExeFilenameNoExt + "." + ext, "");
|
||||
|
||||
if (App.VideoTypes.Contains(ext))
|
||||
RegHelp.SetObject(@"HKCR\" + "." + ext, "PerceivedType", "video");
|
||||
RegistryHelp.SetValue(@"HKCR\" + "." + ext, "PerceivedType", "video");
|
||||
|
||||
if (App.AudioTypes.Contains(ext))
|
||||
RegHelp.SetObject(@"HKCR\" + "." + ext, "PerceivedType", "audio");
|
||||
RegistryHelp.SetValue(@"HKCR\" + "." + ext, "PerceivedType", "audio");
|
||||
|
||||
if (App.ImageTypes.Contains(ext))
|
||||
RegHelp.SetObject(@"HKCR\" + "." + ext, "PerceivedType", "image");
|
||||
RegistryHelp.SetValue(@"HKCR\" + "." + ext, "PerceivedType", "image");
|
||||
|
||||
RegHelp.SetObject($@"HKCR\" + ExeFilenameNoExt + "." + ext + @"\shell\open", null, "Play with " + Application.ProductName);
|
||||
RegHelp.SetObject($@"HKCR\" + ExeFilenameNoExt + "." + ext + @"\shell\open\command", null, $"\"{ExePath}\" \"%1\"");
|
||||
RegHelp.SetObject(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities\FileAssociations", "." + ext, ExeFilenameNoExt + "." + ext);
|
||||
RegistryHelp.SetValue($@"HKCR\" + ExeFilenameNoExt + "." + ext + @"\shell\open", null, "Play with " + Application.ProductName);
|
||||
RegistryHelp.SetValue($@"HKCR\" + ExeFilenameNoExt + "." + ext + @"\shell\open\command", null, $"\"{ExePath}\" \"%1\"");
|
||||
RegistryHelp.SetValue(@"HKLM\SOFTWARE\Clients\Media\mpv.net\Capabilities\FileAssociations", "." + ext, ExeFilenameNoExt + "." + ext);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Unregister()
|
||||
{
|
||||
RegHelp.RemoveKey($@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename);
|
||||
RegHelp.RemoveKey($@"HKCR\Applications\" + ExeFilename);
|
||||
RegHelp.RemoveKey($@"HKLM\SOFTWARE\Clients\Media\mpv.net");
|
||||
RegHelp.RemoveKey($@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename);
|
||||
RegHelp.RemoveKey($@"HKCR\SystemFileAssociations\audio\OpenWithList\" + ExeFilename);
|
||||
RegHelp.RemoveValue(@"HKLM\SOFTWARE\RegisteredApplications", "mpv.net");
|
||||
RegistryHelp.RemoveKey($@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename);
|
||||
RegistryHelp.RemoveKey($@"HKCR\Applications\" + ExeFilename);
|
||||
RegistryHelp.RemoveKey($@"HKLM\SOFTWARE\Clients\Media\mpv.net");
|
||||
RegistryHelp.RemoveKey($@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename);
|
||||
RegistryHelp.RemoveKey($@"HKCR\SystemFileAssociations\audio\OpenWithList\" + ExeFilename);
|
||||
RegistryHelp.RemoveValue(@"HKLM\SOFTWARE\RegisteredApplications", "mpv.net");
|
||||
|
||||
foreach (string id in Registry.ClassesRoot.GetSubKeyNames())
|
||||
{
|
||||
if (id.StartsWith(ExeFilenameNoExt + "."))
|
||||
Registry.ClassesRoot.DeleteSubKeyTree(id);
|
||||
|
||||
RegHelp.RemoveValue($@"HKCR\Software\Classes\{id}\OpenWithProgIDs", ExeFilenameNoExt + id);
|
||||
RegHelp.RemoveValue($@"HKLM\Software\Classes\{id}\OpenWithProgIDs", ExeFilenameNoExt + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class RegHelp
|
||||
{
|
||||
public static void SetObject(string path, string name, object value)
|
||||
{
|
||||
using (RegistryKey regKey = GetRootKey(path).CreateSubKey(path.Substring(5), RegistryKeyPermissionCheck.ReadWriteSubTree))
|
||||
regKey.SetValue(name, value);
|
||||
}
|
||||
|
||||
public static string GetString(string path, string name, string defaultValue = "")
|
||||
{
|
||||
object value = GetObject(path, name, defaultValue);
|
||||
return !(value is string) ? defaultValue : value.ToString();
|
||||
}
|
||||
|
||||
public static int GetInt(string path, string name, int defaultValue = 0)
|
||||
{
|
||||
object value = GetObject(path, name, defaultValue);
|
||||
return !(value is int) ? defaultValue : (int)value;
|
||||
}
|
||||
|
||||
public static object GetObject(string path, string name, object defaultValue = null)
|
||||
{
|
||||
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5)))
|
||||
return regKey == null ? null : regKey.GetValue(name, defaultValue);
|
||||
}
|
||||
|
||||
public static void RemoveKey(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public static void RemoveValue(string path, string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5), true))
|
||||
if (regKey != null)
|
||||
regKey.DeleteValue(name, false);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
static RegistryKey GetRootKey(string path)
|
||||
{
|
||||
switch (path.Substring(0, 4))
|
||||
{
|
||||
case "HKLM": return Registry.LocalMachine;
|
||||
case "HKCU": return Registry.CurrentUser;
|
||||
case "HKCR": return Registry.ClassesRoot;
|
||||
default: throw new Exception();
|
||||
RegistryHelp.RemoveValue($@"HKCR\Software\Classes\{id}\OpenWithProgIDs", ExeFilenameNoExt + id);
|
||||
RegistryHelp.RemoveValue($@"HKLM\Software\Classes\{id}\OpenWithProgIDs", ExeFilenameNoExt + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,7 +260,7 @@ namespace mpvnet
|
||||
|
||||
public class Folder
|
||||
{
|
||||
public static string Startup { get; } = Application.StartupPath + "\\";
|
||||
public static string Startup { get; } = Application.StartupPath + @"\";
|
||||
}
|
||||
|
||||
public class PathHelp
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
70
mpv.net/Misc/RegistryHelp.cs
Normal file
70
mpv.net/Misc/RegistryHelp.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Forms;
|
||||
|
||||
public class RegistryHelp
|
||||
{
|
||||
public static string ApplicationKey { get; } = @"HKCU\Software\" + Application.ProductName;
|
||||
|
||||
public static void SetValue(string path, string name, object value)
|
||||
{
|
||||
using (RegistryKey regKey = GetRootKey(path).CreateSubKey(path.Substring(5), RegistryKeyPermissionCheck.ReadWriteSubTree))
|
||||
regKey.SetValue(name, value);
|
||||
}
|
||||
|
||||
public static string GetString(string path, string name, string defaultValue = "")
|
||||
{
|
||||
object value = GetValue(path, name, defaultValue);
|
||||
return !(value is string) ? defaultValue : value.ToString();
|
||||
}
|
||||
|
||||
public static int GetInt(string path, string name, int defaultValue = 0)
|
||||
{
|
||||
object value = GetValue(path, name, defaultValue);
|
||||
return !(value is int) ? defaultValue : (int)value;
|
||||
}
|
||||
|
||||
public static bool GetBool(string path, string name, bool defaultValue = false)
|
||||
{
|
||||
object val = GetValue(path, name, defaultValue);
|
||||
return val is bool ? (bool)val : defaultValue;
|
||||
}
|
||||
|
||||
public static object GetValue(string path, string name, object defaultValue = null)
|
||||
{
|
||||
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5)))
|
||||
return regKey == null ? null : regKey.GetValue(name, defaultValue);
|
||||
}
|
||||
|
||||
public static void RemoveKey(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static void RemoveValue(string path, string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5), true))
|
||||
if (regKey != null)
|
||||
regKey.DeleteValue(name, false);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
static RegistryKey GetRootKey(string path)
|
||||
{
|
||||
switch (path.Substring(0, 4))
|
||||
{
|
||||
case "HKLM": return Registry.LocalMachine;
|
||||
case "HKCU": return Registry.CurrentUser;
|
||||
case "HKCR": return Registry.ClassesRoot;
|
||||
default: throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
78
mpv.net/Misc/UpdateCheck.cs
Normal file
78
mpv.net/Misc/UpdateCheck.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
class UpdateCheck
|
||||
{
|
||||
public static void DailyCheck()
|
||||
{
|
||||
if (App.UpdateCheck && RegistryHelp.GetInt(RegistryHelp.ApplicationKey, "LastUpdateCheck")
|
||||
!= DateTime.Now.DayOfYear)
|
||||
|
||||
CheckOnline();
|
||||
}
|
||||
|
||||
public static async void CheckOnline(bool showUpToDateMessage = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "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-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 (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 = $"-File \"{Folder.Startup + "Update.ps1"}\" \"{url}\" \"{Application.StartupPath}\"";
|
||||
|
||||
// if (asAdmin)
|
||||
// proc.StartInfo.Verb = "runas";
|
||||
|
||||
// proc.Start();
|
||||
//}
|
||||
|
||||
//mp.command("quit");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (showUpToDateMessage)
|
||||
Msg.ShowException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -6,11 +6,11 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("mpv.net")]
|
||||
[assembly: AssemblyDescription("media player")]
|
||||
[assembly: AssemblyDescription("mpv based media player")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Frank Skare (stax76)")]
|
||||
[assembly: AssemblyProduct("mpv.net")]
|
||||
[assembly: AssemblyCopyright("Copyright 2017-2019 Frank Skare (stax76)")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017-2019 Frank Skare (stax76)")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@@ -502,6 +502,15 @@ file = "mpv"
|
||||
filter = "Input"
|
||||
help = "Number of key presses to generate per second on autorepeat."
|
||||
|
||||
[[settings]]
|
||||
name = "update-check"
|
||||
file = "mpvnet"
|
||||
default = "no"
|
||||
filter = "General"
|
||||
help = "Daily check for new version. (mpv.net specific setting)"
|
||||
options = [{ name = "yes" },
|
||||
{ name = "no" }]
|
||||
|
||||
[[settings]]
|
||||
name = "process-instance"
|
||||
file = "mpvnet"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# space character to make it easier to do a text search, so if you want to know
|
||||
# if 'o' has already a binding you can make a text search on ' o '.
|
||||
|
||||
# mpv input commands: https://github.com/stax76/mpv.net/wiki/mpv-input-commands
|
||||
# mpv input commands: https://mpv.io/manual/master/#list-of-input-commands
|
||||
|
||||
# mpv input keys: https://github.com/stax76/mpv.net/wiki/mpv-input-keys
|
||||
|
||||
@@ -157,21 +157,14 @@
|
||||
Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding
|
||||
_ script-message mpv.net show-setup-dialog #menu: Tools > OS Setup...
|
||||
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/Manual.md #menu: Help > mpv.net Manual
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net #menu: Help > mpv.net GitHub
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/wiki #menu: Help > mpv.net Wiki
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net#support #menu: Help > mpv.net Support
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/releases #menu: Help > mpv.net Download
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt #menu: Help > mpv.net Default Key Bindings
|
||||
_ ignore #menu: Help > -
|
||||
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > mpv Manual
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/wiki #menu: Help > mpv Wiki
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/wiki/User-Scripts #menu: Help > mpv User Scripts
|
||||
_ script-message mpv.net shell-execute https://mpv.io/bug-reports/ #menu: Help > mpv Bugs and Requests
|
||||
_ script-message mpv.net shell-execute https://mpv.io/installation/ #menu: Help > mpv Download
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: Help > mpv Default Key Bindings
|
||||
_ ignore #menu: Help > -
|
||||
_ script-message mpv.net show-about #menu: Help > About mpv.net
|
||||
_ script-message mpv.net shell-execute https://mpv.io #menu: Help > Website mpv
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net #menu: Help > Website mpv.net
|
||||
_ ignore #menu: Help > -
|
||||
_ 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/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
|
||||
|
||||
_ ignore #menu: -
|
||||
Esc quit #menu: Exit
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace mpvnet
|
||||
LoadConf(App.ConfPath);
|
||||
LoadSettings();
|
||||
InitialContent = GetCompareString();
|
||||
SearchControl.Text = RegHelp.GetString(App.RegPath, "ConfigEditorSearch");
|
||||
SearchControl.Text = RegistryHelp.GetString(App.RegPath, "ConfigEditorSearch");
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
@@ -68,7 +68,7 @@ namespace mpvnet
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
RegHelp.SetObject(App.RegPath, "ConfigEditorSearch", SearchControl.Text);
|
||||
RegistryHelp.SetValue(App.RegPath, "ConfigEditorSearch", SearchControl.Text);
|
||||
|
||||
if (InitialContent == GetCompareString())
|
||||
return;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace mpvnet
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var proc = new Process())
|
||||
using (Process proc = new Process())
|
||||
{
|
||||
proc.StartInfo.FileName = WinForms.Application.ExecutablePath;
|
||||
proc.StartInfo.Arguments = "--reg-file-assoc " + value;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace mpvnet
|
||||
|
||||
try
|
||||
{
|
||||
object recent = RegHelp.GetObject(App.RegPath, "Recent");
|
||||
object recent = RegistryHelp.GetValue(App.RegPath, "Recent");
|
||||
|
||||
if (recent is string[] r)
|
||||
RecentFiles = new List<string>(r);
|
||||
@@ -91,8 +91,8 @@ namespace mpvnet
|
||||
Left = target.X + (target.Width - Width) / 2;
|
||||
Top = target.Y + (target.Height - Height) / 2;
|
||||
|
||||
int posX = RegHelp.GetInt(App.RegPath, "PosX");
|
||||
int posY = RegHelp.GetInt(App.RegPath, "PosY");
|
||||
int posX = RegistryHelp.GetInt(App.RegPath, "PosX");
|
||||
int posY = RegistryHelp.GetInt(App.RegPath, "PosY");
|
||||
|
||||
if (posX != 0 && posY != 0 && App.RememberPosition)
|
||||
{
|
||||
@@ -472,7 +472,7 @@ namespace mpvnet
|
||||
break;
|
||||
case 0x0200: // WM_MOUSEMOVE
|
||||
{
|
||||
if ((DateTime.Now - LastCycleFullscreen).TotalMilliseconds > 100)
|
||||
if ((DateTime.Now - LastCycleFullscreen).TotalMilliseconds > 500)
|
||||
{
|
||||
Point pos = PointToClient(Cursor.Position);
|
||||
mp.command($"mouse {pos.X} {pos.Y}");
|
||||
@@ -483,61 +483,69 @@ namespace mpvnet
|
||||
}
|
||||
break;
|
||||
case 0x2a3: // WM_MOUSELEAVE
|
||||
mp.command("mouse 1 1"); // osc won't always auto hide
|
||||
// osc won't always auto hide
|
||||
mp.command("mouse 1 1");
|
||||
break;
|
||||
case 0x203: // Native.WM.LBUTTONDBLCLK
|
||||
case 0x203: // WM_LBUTTONDBLCLK
|
||||
{
|
||||
Point pos = PointToClient(Cursor.Position);
|
||||
mp.command($"mouse {pos.X} {pos.Y} 0 double");
|
||||
}
|
||||
break;
|
||||
case 0x02E0: // WM_DPICHANGED
|
||||
if (!WasShown)
|
||||
break;
|
||||
var r2 = Marshal.PtrToStructure<Native.RECT>(m.LParam);
|
||||
Native.SetWindowPos(Handle, IntPtr.Zero, r2.Left, r2.Top, r2.Width, r2.Height, 0);
|
||||
{
|
||||
if (!WasShown)
|
||||
break;
|
||||
|
||||
Native.RECT rect = Marshal.PtrToStructure<Native.RECT>(m.LParam);
|
||||
Native.SetWindowPos(Handle, IntPtr.Zero, rect.Left, rect.Top, rect.Width, rect.Height, 0);
|
||||
}
|
||||
break;
|
||||
case 0x0214: // WM_SIZING
|
||||
var rc = Marshal.PtrToStructure<Native.RECT>(m.LParam);
|
||||
var r = rc;
|
||||
NativeHelp.SubtractWindowBorders(Handle, ref r);
|
||||
int c_w = r.Right - r.Left, c_h = r.Bottom - r.Top;
|
||||
Size s = mp.VideoSize;
|
||||
{
|
||||
var rc = Marshal.PtrToStructure<Native.RECT>(m.LParam);
|
||||
var r = rc;
|
||||
NativeHelp.SubtractWindowBorders(Handle, ref r);
|
||||
int c_w = r.Right - r.Left, c_h = r.Bottom - r.Top;
|
||||
Size s = mp.VideoSize;
|
||||
|
||||
if (s == Size.Empty)
|
||||
s = new Size(16, 9);
|
||||
if (s == Size.Empty)
|
||||
s = new Size(16, 9);
|
||||
|
||||
float aspect = s.Width / (float)s.Height;
|
||||
int d_w = Convert.ToInt32(c_h * aspect - c_w);
|
||||
int d_h = Convert.ToInt32(c_w / aspect - c_h);
|
||||
int[] d_corners = { d_w, d_h, -d_w, -d_h };
|
||||
int[] corners = { rc.Left, rc.Top, rc.Right, rc.Bottom };
|
||||
int corner = NativeHelp.GetResizeBorder(m.WParam.ToInt32());
|
||||
float aspect = s.Width / (float)s.Height;
|
||||
int d_w = Convert.ToInt32(c_h * aspect - c_w);
|
||||
int d_h = Convert.ToInt32(c_w / aspect - c_h);
|
||||
int[] d_corners = { d_w, d_h, -d_w, -d_h };
|
||||
int[] corners = { rc.Left, rc.Top, rc.Right, rc.Bottom };
|
||||
int corner = NativeHelp.GetResizeBorder(m.WParam.ToInt32());
|
||||
|
||||
if (corner >= 0)
|
||||
corners[corner] -= d_corners[corner];
|
||||
if (corner >= 0)
|
||||
corners[corner] -= d_corners[corner];
|
||||
|
||||
Marshal.StructureToPtr<Native.RECT>(new Native.RECT(corners[0], corners[1], corners[2], corners[3]), m.LParam, false);
|
||||
m.Result = new IntPtr(1);
|
||||
Marshal.StructureToPtr<Native.RECT>(new Native.RECT(corners[0], corners[1], corners[2], corners[3]), m.LParam, false);
|
||||
m.Result = new IntPtr(1);
|
||||
}
|
||||
return;
|
||||
case 0x004A: // WM_COPYDATA
|
||||
var copyData = (Native.COPYDATASTRUCT)m.GetLParam(typeof(Native.COPYDATASTRUCT));
|
||||
string[] files = copyData.lpData.Split('\n');
|
||||
string mode = files[0];
|
||||
files = files.Skip(1).ToArray();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case "single":
|
||||
mp.Load(files, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
break;
|
||||
case "queue":
|
||||
foreach (string file in files)
|
||||
mp.commandv("loadfile", file, "append");
|
||||
break;
|
||||
}
|
||||
var copyData = (Native.COPYDATASTRUCT)m.GetLParam(typeof(Native.COPYDATASTRUCT));
|
||||
string[] files = copyData.lpData.Split('\n');
|
||||
string mode = files[0];
|
||||
files = files.Skip(1).ToArray();
|
||||
|
||||
Activate();
|
||||
switch (mode)
|
||||
{
|
||||
case "single":
|
||||
mp.Load(files, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
break;
|
||||
case "queue":
|
||||
foreach (string file in files)
|
||||
mp.commandv("loadfile", file, "append");
|
||||
break;
|
||||
}
|
||||
|
||||
Activate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -624,6 +632,7 @@ namespace mpvnet
|
||||
if (mp.GPUAPI != "vulkan")
|
||||
mp.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
|
||||
|
||||
LastCycleFullscreen = DateTime.Now;
|
||||
SetFormPosAndSize();
|
||||
}
|
||||
|
||||
@@ -645,9 +654,10 @@ namespace mpvnet
|
||||
WPF.WPF.Init();
|
||||
System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
|
||||
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
|
||||
WasShown = true;
|
||||
UpdateCheck.DailyCheck();
|
||||
mp.LoadScripts();
|
||||
Task.Run(() => App.Extension = new Extension());
|
||||
WasShown = true;
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
@@ -664,11 +674,11 @@ namespace mpvnet
|
||||
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
RegHelp.SetObject(App.RegPath, "PosX", Left + Width / 2);
|
||||
RegHelp.SetObject(App.RegPath, "PosY", Top + Height / 2);
|
||||
RegistryHelp.SetValue(App.RegPath, "PosX", Left + Width / 2);
|
||||
RegistryHelp.SetValue(App.RegPath, "PosY", Top + Height / 2);
|
||||
}
|
||||
|
||||
RegHelp.SetObject(App.RegPath, "Recent", RecentFiles.ToArray());
|
||||
RegistryHelp.SetValue(App.RegPath, "Recent", RecentFiles.ToArray());
|
||||
|
||||
if (mp.IsQuitNeeded)
|
||||
mp.commandv("quit");
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.PowerShell.5.ReferenceAssemblies.1.1.0\lib\net4\System.Management.Automation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
@@ -142,6 +143,8 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Compile Include="Misc\Help.cs" />
|
||||
<Compile Include="Misc\UpdateCheck.cs" />
|
||||
<Compile Include="Misc\RegistryHelp.cs" />
|
||||
<Compile Include="Misc\Theme.cs" />
|
||||
<Compile Include="WPF\SearchTextBoxUserControl.xaml.cs">
|
||||
<DependentUpon>SearchTextBoxUserControl.xaml</DependentUpon>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
@@ -155,7 +156,7 @@ namespace mpvnet
|
||||
_ConfigFolder = portableFolder;
|
||||
|
||||
if (!Directory.Exists(_ConfigFolder))
|
||||
_ConfigFolder = RegHelp.GetString(App.RegPath, "ConfigFolder");
|
||||
_ConfigFolder = RegistryHelp.GetString(App.RegPath, "ConfigFolder");
|
||||
|
||||
if (!Directory.Exists(_ConfigFolder))
|
||||
{
|
||||
@@ -202,7 +203,7 @@ namespace mpvnet
|
||||
Directory.CreateDirectory(_ConfigFolder);
|
||||
|
||||
if (!_ConfigFolder.Contains("portable_config"))
|
||||
RegHelp.SetObject(App.RegPath, "ConfigFolder", _ConfigFolder);
|
||||
RegistryHelp.SetValue(App.RegPath, "ConfigFolder", _ConfigFolder);
|
||||
|
||||
if (!File.Exists(_ConfigFolder + "input.conf"))
|
||||
File.WriteAllText(_ConfigFolder + "input.conf", Properties.Resources.inputConf);
|
||||
|
||||
Reference in New Issue
Block a user