From 3164e2322c05934ded8e05a0c5a1d735fe4719f0 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Fri, 3 May 2019 18:27:05 +0200 Subject: [PATCH] - --- README.md | 4 ++++ mpv.net/Command.cs | 20 ++++++++++++++++++++ mpv.net/Program.cs | 2 +- mpv.net/Resources/inputConf.txt | 1 + setup.iss | 2 +- 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d9ec839..519259e 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,10 @@ mpv.net bugs and requests: ### Changelog +### 3.4 (2019-??-??) + +- new feature added to manage file associations, can be found in the menu at: Tools > Manage... + ### 3.3 (2019-05-01) - dark mode support was added to the command palette and partly to the input editor diff --git a/mpv.net/Command.cs b/mpv.net/Command.cs index fb9393e..bb6e905 100644 --- a/mpv.net/Command.cs +++ b/mpv.net/Command.cs @@ -239,5 +239,25 @@ namespace mpvnet mp.commandv("show-text", audTracks[aid - 1].Text.Substring(3), "5000"); } } + + public static void manage_file_associations(string[] args) + { + using (var td = new TaskDialog()) + { + td.MainInstruction = "Choose an option."; + + td.AddCommandLink("Register video file extensions", "video"); + td.AddCommandLink("Register audio file extensions", "audio"); + td.AddCommandLink("Unregister file extensions", "unreg"); + + using (var p = new Process()) + { + p.StartInfo.FileName = Application.ExecutablePath; + p.StartInfo.Arguments = "--reg-file-assoc " + td.Show(); + p.StartInfo.Verb = "runas"; + p.Start(); + } + } + } } } \ No newline at end of file diff --git a/mpv.net/Program.cs b/mpv.net/Program.cs index 77a4f56..881fbb5 100644 --- a/mpv.net/Program.cs +++ b/mpv.net/Program.cs @@ -18,7 +18,7 @@ namespace mpvnet { if (args[2] == "audio") FileAssociation.Register(FileAssociation.AudioTypes); if (args[2] == "video") FileAssociation.Register(FileAssociation.VideoTypes); - if (args[2] == "unregister") FileAssociation.Unregister(); + if (args[2] == "unreg") FileAssociation.Unregister(); return; } diff --git a/mpv.net/Resources/inputConf.txt b/mpv.net/Resources/inputConf.txt index 65646fa..f23d52e 100644 --- a/mpv.net/Resources/inputConf.txt +++ b/mpv.net/Resources/inputConf.txt @@ -146,6 +146,7 @@ L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Cycle Hardware Decoding _ script-message mpv.net execute-mpv-command #menu: Tools > Execute mpv command... + _ script-message mpv.net manage-file-associations #menu: Tools > Manage File Associations... _ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Show mpv manual _ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: Help > Show mpv default keys diff --git a/setup.iss b/setup.iss index 4e972ea..ea6de5d 100644 --- a/setup.iss +++ b/setup.iss @@ -29,4 +29,4 @@ Filename: "{app}\{#MyAppExeName}"; Description: "Associate video file extensions Filename: "{app}\{#MyAppExeName}"; Description: "Associate audio file extensions?"; Flags: postinstall unchecked runascurrentuser runhidden nowait; Parameters: "--reg-file-assoc audio" [UninstallRun] -Filename: "{app}\{#MyAppExeName}"; Flags: runascurrentuser runhidden; Parameters: "--reg-file-assoc unregister" \ No newline at end of file +Filename: "{app}\{#MyAppExeName}"; Flags: runascurrentuser runhidden; Parameters: "--reg-file-assoc unreg" \ No newline at end of file