From 89aa0c6133eb119c7fcc9680d0a7fb27a0ab1d30 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Sun, 14 Jul 2019 06:07:25 +0200 Subject: [PATCH] added image format support to the info command, to file association management, to folder loading, to Everything --- Changelog.md | 3 ++- mpv.net/Misc/Command.cs | 1 + mpv.net/Misc/Misc.cs | 2 ++ mpv.net/Misc/Program.cs | 1 + mpv.net/WPF/EverythingWindow.xaml.cs | 6 +++++- mpv.net/mpv/mp.cs | 3 ++- setup.iss | 1 + 7 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index c34091a..fea6d83 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,8 @@ - fix cursor showing load activity on startup - added file size and type to info command using audio files -- added image format support for the info command +- added image format support to the info command, to file + association management, to folder loading, to Everything ### 4.7.1 diff --git a/mpv.net/Misc/Command.cs b/mpv.net/Misc/Command.cs index 5a07489..403e2bd 100644 --- a/mpv.net/Misc/Command.cs +++ b/mpv.net/Misc/Command.cs @@ -236,6 +236,7 @@ namespace mpvnet td.AddCommandLink("Register video file extensions", "video"); td.AddCommandLink("Register audio file extensions", "audio"); + td.AddCommandLink("Register audio file extensions", "image"); td.AddCommandLink("Unregister file extensions", "unreg"); string result = td.Show(); diff --git a/mpv.net/Misc/Misc.cs b/mpv.net/Misc/Misc.cs index bb3ee70..5d8685d 100644 --- a/mpv.net/Misc/Misc.cs +++ b/mpv.net/Misc/Misc.cs @@ -190,6 +190,8 @@ namespace mpvnet RegHelp.SetObject($"HKCR\\" + "." + ext, "PerceivedType", "video"); if (App.AudioTypes.Contains(ext)) RegHelp.SetObject($"HKCR\\" + "." + ext, "PerceivedType", "audio"); + if (App.ImageTypes.Contains(ext)) + RegHelp.SetObject($"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); diff --git a/mpv.net/Misc/Program.cs b/mpv.net/Misc/Program.cs index 4344a20..36e92d9 100644 --- a/mpv.net/Misc/Program.cs +++ b/mpv.net/Misc/Program.cs @@ -21,6 +21,7 @@ namespace mpvnet { if (args[1] == "audio") FileAssociation.Register(App.AudioTypes); if (args[1] == "video") FileAssociation.Register(App.VideoTypes); + if (args[1] == "image") FileAssociation.Register(App.ImageTypes); if (args[1] == "unreg") FileAssociation.Unregister(); return; } diff --git a/mpv.net/WPF/EverythingWindow.xaml.cs b/mpv.net/WPF/EverythingWindow.xaml.cs index e3910f8..b578825 100644 --- a/mpv.net/WPF/EverythingWindow.xaml.cs +++ b/mpv.net/WPF/EverythingWindow.xaml.cs @@ -141,8 +141,12 @@ namespace mpvnet { Everything_GetResultFullPathName(i, buf, bufsize); string ext = Path.GetExtension(buf.ToString()).TrimStart('.').ToLower(); - if (App.AudioTypes.Contains(ext) || App.VideoTypes.Contains(ext)) + + if (App.AudioTypes.Contains(ext) || App.VideoTypes.Contains(ext) || + App.ImageTypes.Contains(ext)) + items.Add(buf.ToString()); + if (items.Count > 100) break; } Application.Current.Dispatcher.Invoke(() => { diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index d8937f4..3720fee 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -585,7 +585,8 @@ namespace mpvnet List files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList(); files = files.Where((file) => App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) || - App.AudioTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower())).ToList(); + App.AudioTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) || + App.ImageTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower())).ToList(); files.Sort(new StringLogicalComparer()); int index = files.IndexOf(path); files.Remove(path); diff --git a/setup.iss b/setup.iss index c0c4ef7..f7261e9 100644 --- a/setup.iss +++ b/setup.iss @@ -39,6 +39,7 @@ Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesub [Run] Filename: "{app}\{#MyAppExeName}"; Description: "Associate video file extensions?"; Flags: postinstall unchecked runascurrentuser runhidden nowait; Parameters: "--reg-file-assoc video" Filename: "{app}\{#MyAppExeName}"; Description: "Associate audio file extensions?"; Flags: postinstall unchecked runascurrentuser runhidden nowait; Parameters: "--reg-file-assoc audio" +Filename: "{app}\{#MyAppExeName}"; Description: "Associate image file extensions?"; Flags: postinstall unchecked runascurrentuser runhidden nowait; Parameters: "--reg-file-assoc image" [UninstallRun] Filename: "{app}\{#MyAppExeName}"; Flags: runascurrentuser runhidden; Parameters: "--reg-file-assoc unreg" \ No newline at end of file