From 8d25803b71e242eea6b51324a43071e51dc6391c Mon Sep 17 00:00:00 2001 From: stax76 Date: Sat, 5 Mar 2022 04:36:09 +0100 Subject: [PATCH] #369 #367 protocol registration --- docs/Changelog.md | 1 + src/Misc/Misc.cs | 17 +++++++++++------ src/Package/Package.appxmanifest | 8 ++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index 7d7e425..2f637c3 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -20,6 +20,7 @@ not yet released - Single character input in the command palette searches exclusivly key bindings much like the search field of the input editor. - Various default key bindings improved. +- New protocol registrations, so far supported are: ytdl, rtsp, srt, srtp - libmpv zhongfly 2022-02-27 diff --git a/src/Misc/Misc.cs b/src/Misc/Misc.cs index 99f4a15..cf05f4c 100644 --- a/src/Misc/Misc.cs +++ b/src/Misc/Misc.cs @@ -78,13 +78,17 @@ namespace mpvnet public static void Register(string perceivedType, string[] extensions) { + string[] protocols = { "ytdl", "rtsp", "srt", "srtp" }; + if (perceivedType != "unreg") { + foreach (string i in protocols) + { + RegistryHelp.SetValue($@"HKCR\{i}", $"{i.ToUpper()} Protocol", ""); + RegistryHelp.SetValue($@"HKCR\{i}\shell\open\command", null, $"\"{ExePath}\" \"%1\""); + } + RegistryHelp.SetValue(@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename, null, ExePath); - RegistryHelp.SetValue(@"HKCR\ytdl", "YTDL Protocol", ""); - RegistryHelp.SetValue(@"HKCR\ytdl\shell\open\command", null, $"\"{ExePath}\" \"%1\""); - RegistryHelp.SetValue(@"HKCR\rtsp", "RTSP Protocol", ""); - RegistryHelp.SetValue(@"HKCR\rtsp\shell\open\command", null, $"\"{ExePath}\" \"%1\""); RegistryHelp.SetValue(@"HKCR\Applications\" + ExeFilename, "FriendlyAppName", "mpv.net media player"); RegistryHelp.SetValue(@"HKCR\Applications\" + ExeFilename + @"\shell\open\command", null, $"\"{ExePath}\" \"%1\""); RegistryHelp.SetValue(@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename, null, ""); @@ -105,8 +109,9 @@ namespace mpvnet } else { - RegistryHelp.RemoveKey(@"HKCR\ytdl"); - RegistryHelp.RemoveKey(@"HKCR\rtsp"); + foreach (string i in protocols) + RegistryHelp.RemoveKey($@"HKCR\{i}"); + RegistryHelp.RemoveKey(@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename); RegistryHelp.RemoveKey(@"HKCR\Applications\" + ExeFilename); RegistryHelp.RemoveKey(@"HKLM\SOFTWARE\Clients\Media\mpv.net"); diff --git a/src/Package/Package.appxmanifest b/src/Package/Package.appxmanifest index 707d3eb..41aa5f0 100644 --- a/src/Package/Package.appxmanifest +++ b/src/Package/Package.appxmanifest @@ -117,6 +117,14 @@ + + + + + + + +