register ytdl protocol with file associations
This commit is contained in:
@@ -81,17 +81,19 @@ namespace mpvnet
|
||||
if (perceivedType != "unreg")
|
||||
{
|
||||
RegistryHelp.SetValue(@"HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\" + ExeFilename, null, ExePath);
|
||||
RegistryHelp.SetValue(@"HKCR\ytdl", "URL Protocol", "");
|
||||
RegistryHelp.SetValue(@"HKCR\ytdl\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(@"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\Applications\" + ExeFilename + @"\shell\open\command", null, $"\"{ExePath}\" \"%1\"");
|
||||
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");
|
||||
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");
|
||||
|
||||
foreach (string ext in extensions)
|
||||
{
|
||||
RegistryHelp.SetValue($@"HKCR\Applications\{ExeFilename}\SupportedTypes", "." + ext, "");
|
||||
RegistryHelp.SetValue(@"HKCR\Applications\" + ExeFilename + @"\SupportedTypes", "." + ext, "");
|
||||
RegistryHelp.SetValue(@"HKCR\" + "." + ext, null, ExeFilenameNoExt + "." + ext);
|
||||
RegistryHelp.SetValue(@"HKCR\" + "." + ext + @"\OpenWithProgIDs", ExeFilenameNoExt + "." + ext, "");
|
||||
RegistryHelp.SetValue(@"HKCR\" + "." + ext, "PerceivedType", perceivedType);
|
||||
@@ -101,11 +103,13 @@ namespace mpvnet
|
||||
}
|
||||
else
|
||||
{
|
||||
RegistryHelp.RemoveKey(@"HKCR\ytdl");
|
||||
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())
|
||||
|
||||
@@ -3,29 +3,22 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
using WinForms = System.Windows.Forms;
|
||||
|
||||
using MsgBoxEx;
|
||||
|
||||
public class Msg
|
||||
{
|
||||
public static void ShowInfo(object title)
|
||||
{
|
||||
Show(title, MessageBoxImage.Information);
|
||||
}
|
||||
public static void ShowInfo(object msg) => Show(msg, MessageBoxImage.Information);
|
||||
|
||||
public static void ShowError(object title)
|
||||
{
|
||||
Show(title, MessageBoxImage.Error);
|
||||
}
|
||||
public static void ShowError(object msg) => Show(msg, MessageBoxImage.Error);
|
||||
|
||||
public static void ShowWarning(object title)
|
||||
{
|
||||
Show(title, MessageBoxImage.Warning);
|
||||
}
|
||||
public static void ShowWarning(object msg) => Show(msg, MessageBoxImage.Warning);
|
||||
|
||||
public static MessageBoxResult ShowQuestion(object title,
|
||||
public static MessageBoxResult ShowQuestion(object msg,
|
||||
MessageBoxButton buttons = MessageBoxButton.OKCancel)
|
||||
{
|
||||
return Show(title, MessageBoxImage.Question, buttons);
|
||||
return Show(msg, MessageBoxImage.Question, buttons);
|
||||
}
|
||||
|
||||
public static void ShowException(Exception exception)
|
||||
@@ -34,17 +27,16 @@ public class Msg
|
||||
}
|
||||
|
||||
public static MessageBoxResult Show(
|
||||
object title,
|
||||
object msg,
|
||||
MessageBoxImage img,
|
||||
MessageBoxButton buttons = MessageBoxButton.OK,
|
||||
string details = null)
|
||||
{
|
||||
MessageBoxResult fn()
|
||||
{
|
||||
string msg = title?.ToString().TrimEx();
|
||||
MessageBoxEx.DetailsText = details;
|
||||
string windowTitle = System.Windows.Forms.Application.ProductName;
|
||||
return MessageBoxEx.OpenMessageBox(msg, windowTitle, buttons, img);
|
||||
return MessageBoxEx.OpenMessageBox((msg ?? "").ToString().Trim(),
|
||||
WinForms.Application.ProductName, buttons, img);
|
||||
}
|
||||
|
||||
ApartmentState state = Thread.CurrentThread.GetApartmentState();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using mpvnet;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
@@ -14,6 +13,8 @@ using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
using mpvnet;
|
||||
|
||||
namespace MsgBoxEx
|
||||
{
|
||||
public partial class MessageBoxEx : Window, INotifyPropertyChanged
|
||||
@@ -377,7 +378,7 @@ namespace MsgBoxEx
|
||||
|
||||
if (DelegateObj != null)
|
||||
{
|
||||
Style style = (Style)(this.FindResource("ImageOpacityChanger"));
|
||||
Style style = (Style)(FindResource("ImageOpacityChanger"));
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user