From 753db299343e1b84e4c734e66c03b502add34bf7 Mon Sep 17 00:00:00 2001 From: Dinesh Solanki <15937452+DineshSolanki@users.noreply.github.com> Date: Tue, 31 Aug 2021 18:36:20 +0530 Subject: [PATCH] Fixed binding on AppStatus, Added command Line args feature --- FoliCon/FoliCon.csproj | 4 ++-- FoliCon/Modules/Util.cs | 27 +++++++++++++++++++++++ FoliCon/ViewModels/AboutBoxViewModel.cs | 2 +- FoliCon/ViewModels/MainWindowViewModel.cs | 16 ++++++++++++++ FoliCon/Views/MainWindow.xaml | 2 +- 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/FoliCon/FoliCon.csproj b/FoliCon/FoliCon.csproj index edfe7d95..f0aee73d 100644 --- a/FoliCon/FoliCon.csproj +++ b/FoliCon/FoliCon.csproj @@ -4,13 +4,13 @@ net5.0-windows true FoliCon - 3.7.0 + 3.7.1 win-x64 Resources\folicon Icon.ico preview 3.7.0 - 3.7.0.0 + 3.7.1.0 Dinesh Solanki Creates Folder icons for Movies, Serials, Music, and Games Folders dineshsolanki.github.io/folicon/ diff --git a/FoliCon/Modules/Util.cs b/FoliCon/Modules/Util.cs index 7ef59871..6ff60ba8 100644 --- a/FoliCon/Modules/Util.cs +++ b/FoliCon/Modules/Util.cs @@ -634,5 +634,32 @@ public static int GetResultCount(bool isPickedById, dynamic result, string searc { return isPickedById ? result != null ? 1 : 0 : searchMode == "Game" ? result.Length : result.TotalResults; } + public static IDictionary GetCmdArgs() + { + IDictionary arguments = new Dictionary(); + var args = Environment.GetCommandLineArgs(); + + for (var index = 1; index < args.Length; index += 2) + { + var arg = args[index].Replace("--", ""); + arguments.Add(arg, args[index + 1]); + } + return arguments; + } + public static void AddToContextMenu() + { + var commandS = $@"""{Process.GetCurrentProcess().MainModule?.FileName}"" --path ""%1"""; + ApplicationHelper.RegisterContextMenuToDirectory("Merge Subtitles", commandS); + commandS = $@"""{Process.GetCurrentProcess().MainModule?.FileName}"" --path ""%V"""; + ApplicationHelper.RegisterContextMenuToBackground("Merge Subtitles", commandS); + //Growl.SuccessGlobal("Merge Subtitle option added to context menu!"); + } + + public static void RemoveFromContextMenu() + { + ApplicationHelper.UnRegisterContextMenuFromDirectory("Merge Subtitles"); + ApplicationHelper.UnRegisterCascadeContextMenuFromBackground("Merge Subtitles"); + //Growl.InfoGlobal("Merge Subtitle option removed from context menu!"); + } } } \ No newline at end of file diff --git a/FoliCon/ViewModels/AboutBoxViewModel.cs b/FoliCon/ViewModels/AboutBoxViewModel.cs index 8384d3b1..8326d680 100644 --- a/FoliCon/ViewModels/AboutBoxViewModel.cs +++ b/FoliCon/ViewModels/AboutBoxViewModel.cs @@ -10,7 +10,7 @@ namespace FoliCon.ViewModels { public class AboutBoxViewModel : BindableBase, IDialogAware { - private string _title = "Folicon v3.7"; + private string _title = "Folicon v3.7.1"; private string _logo = "/Resources/folicon Icon.png"; private string _description = LangProvider.GetLang("FoliConDescription"); diff --git a/FoliCon/ViewModels/MainWindowViewModel.cs b/FoliCon/ViewModels/MainWindowViewModel.cs index 75466fea..1bafe048 100644 --- a/FoliCon/ViewModels/MainWindowViewModel.cs +++ b/FoliCon/ViewModels/MainWindowViewModel.cs @@ -209,6 +209,22 @@ public MainWindowViewModel(IDialogService dialogService) .PersistOn(nameof(PropertyChanged)); Services.Tracker.Track(this); Util.CheckForUpdate(true); + var cmdArgs = Util.GetCmdArgs(); + if (!cmdArgs.ContainsKey("path")) return; + SelectedFolder = cmdArgs["path"]; + var mode = cmdArgs["mode"]; + if (mode != "Professional" && new List() + {"Auto (Movies & TV Shows)","TV","Movie","Game"}.Contains(mode)) + { + IconMode = "Poster"; + SearchMode = mode; + } + else + { + IconMode = "Professional"; + } + SearchAndMakeMethod(); + } private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) diff --git a/FoliCon/Views/MainWindow.xaml b/FoliCon/Views/MainWindow.xaml index 4be792fd..ad50369b 100644 --- a/FoliCon/Views/MainWindow.xaml +++ b/FoliCon/Views/MainWindow.xaml @@ -240,7 +240,7 @@ -