#369 #367 protocol registration

This commit is contained in:
stax76
2022-03-05 04:36:09 +01:00
parent df4baca6bc
commit 8d25803b71
3 changed files with 20 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ not yet released
- Single character input in the command palette searches exclusivly - Single character input in the command palette searches exclusivly
key bindings much like the search field of the input editor. key bindings much like the search field of the input editor.
- Various default key bindings improved. - Various default key bindings improved.
- New protocol registrations, so far supported are: ytdl, rtsp, srt, srtp
- libmpv zhongfly 2022-02-27 - libmpv zhongfly 2022-02-27

View File

@@ -78,13 +78,17 @@ namespace mpvnet
public static void Register(string perceivedType, string[] extensions) public static void Register(string perceivedType, string[] extensions)
{ {
string[] protocols = { "ytdl", "rtsp", "srt", "srtp" };
if (perceivedType != "unreg") 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(@"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, "FriendlyAppName", "mpv.net media player");
RegistryHelp.SetValue(@"HKCR\Applications\" + ExeFilename + @"\shell\open\command", null, $"\"{ExePath}\" \"%1\""); RegistryHelp.SetValue(@"HKCR\Applications\" + ExeFilename + @"\shell\open\command", null, $"\"{ExePath}\" \"%1\"");
RegistryHelp.SetValue(@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename, null, ""); RegistryHelp.SetValue(@"HKCR\SystemFileAssociations\video\OpenWithList\" + ExeFilename, null, "");
@@ -105,8 +109,9 @@ namespace mpvnet
} }
else else
{ {
RegistryHelp.RemoveKey(@"HKCR\ytdl"); foreach (string i in protocols)
RegistryHelp.RemoveKey(@"HKCR\rtsp"); RegistryHelp.RemoveKey($@"HKCR\{i}");
RegistryHelp.RemoveKey(@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename); RegistryHelp.RemoveKey(@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename);
RegistryHelp.RemoveKey(@"HKCR\Applications\" + ExeFilename); RegistryHelp.RemoveKey(@"HKCR\Applications\" + ExeFilename);
RegistryHelp.RemoveKey(@"HKLM\SOFTWARE\Clients\Media\mpv.net"); RegistryHelp.RemoveKey(@"HKLM\SOFTWARE\Clients\Media\mpv.net");

View File

@@ -117,6 +117,14 @@
<uap:Extension Category="windows.protocol"> <uap:Extension Category="windows.protocol">
<uap:Protocol Name="rtsp" /> <uap:Protocol Name="rtsp" />
</uap:Extension> </uap:Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="srt" />
</uap:Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="srtp" />
</uap:Extension>
</Extensions> </Extensions>
</Application> </Application>