From 5d55ce8af1140d914c5b66bb5470e53bd778bd8f Mon Sep 17 00:00:00 2001 From: Dinesh Solanki <15937452+DineshSolanki@users.noreply.github.com> Date: Fri, 6 Aug 2021 20:14:02 +0530 Subject: [PATCH] added option to delete media info files(info.folicon) translation related to mediaInfo feature added. --- FoliCon/Models/GlobalVariables.cs | 2 ++ FoliCon/Modules/LangProvider.cs | 14 +++++++-- FoliCon/Modules/Util.cs | 17 ++++++++--- FoliCon/Properties/Langs/Lang.Designer.cs | 37 +++++++++++++++++++++++ FoliCon/Properties/Langs/Lang.ar.resx | 13 ++++++++ FoliCon/Properties/Langs/Lang.es.resx | 13 ++++++++ FoliCon/Properties/Langs/Lang.hi.resx | 16 ++++++++++ FoliCon/Properties/Langs/Lang.resx | 13 ++++++++ FoliCon/Properties/Langs/Lang.ru.resx | 13 ++++++++ FoliCon/ViewModels/MainWindowViewModel.cs | 19 ++++++++++++ FoliCon/Views/MainWindow.xaml | 3 ++ Folicon.sln.DotSettings | 2 ++ 12 files changed, 156 insertions(+), 6 deletions(-) create mode 100644 Folicon.sln.DotSettings diff --git a/FoliCon/Models/GlobalVariables.cs b/FoliCon/Models/GlobalVariables.cs index a64d4595..548dc8ed 100644 --- a/FoliCon/Models/GlobalVariables.cs +++ b/FoliCon/Models/GlobalVariables.cs @@ -12,5 +12,7 @@ internal static class GlobalVariables "Alternate" => IconOverlay.Alternate, _ => IconOverlay.Alternate }; + + public static string MediaInfoFile = "info.folicon"; } } \ No newline at end of file diff --git a/FoliCon/Modules/LangProvider.cs b/FoliCon/Modules/LangProvider.cs index 95d1c1ab..c915b644 100644 --- a/FoliCon/Modules/LangProvider.cs +++ b/FoliCon/Modules/LangProvider.cs @@ -161,7 +161,10 @@ private void UpdateLangs() OnPropertyChanged(nameof(UsePosterOverlay)); OnPropertyChanged(nameof(Version)); OnPropertyChanged(nameof(Year)); - OnPropertyChanged(nameof(ExceptionOccurred)); + OnPropertyChanged(nameof(DeleteMediaInfo)); + OnPropertyChanged(nameof(DeleteMediaInfoTooltip)); + OnPropertyChanged(nameof(DeleteMediaInfoConfirmation)); + OnPropertyChanged(nameof(ConfirmMediaInfoDeletion)); } public string About => Lang.About; @@ -412,6 +415,10 @@ private void UpdateLangs() public string Year => Lang.Year; public string ExceptionOccurred => Lang.ExceptionOccurred; + public string ConfirmMediaInfoDeletion => Lang.ConfirmMediaInfoDeletion; + public string DeleteMediaInfoConfirmation => Lang.DeleteMediaInfoConfirmation; + public string DeleteMediaInfoTooltip => Lang.DeleteMediaInfoTooltip; + public string DeleteMediaInfo => Lang.DeleteMediaInfo; public event PropertyChangedEventHandler PropertyChanged; @@ -671,6 +678,9 @@ public class LangKeys public static string Year = nameof(Year); public static string ExceptionOccurred = nameof(ExceptionOccurred); - + public static string ConfirmMediaInfoDeletion = nameof(ConfirmMediaInfoDeletion); + public static string DeleteMediaInfoConfirmation = nameof(DeleteMediaInfoConfirmation); + public static string DeleteMediaInfoTooltip = nameof(DeleteMediaInfoTooltip); + public static string DeleteMediaInfo = nameof(DeleteMediaInfo); } } \ No newline at end of file diff --git a/FoliCon/Modules/Util.cs b/FoliCon/Modules/Util.cs index 247c4a18..c5003017 100644 --- a/FoliCon/Modules/Util.cs +++ b/FoliCon/Modules/Util.cs @@ -191,6 +191,15 @@ public static void DeleteIconsFromFolder(string folderPath) File.Delete(icoFile); File.Delete(iniFile); } + + public static void DeleteMediaInfoFromSubfolders(string folderPath) + { + foreach (var folder in Directory.EnumerateDirectories(folderPath)) + { + var icoFile = Path.Combine(folder, GlobalVariables.MediaInfoFile); + File.Delete(icoFile); + } + } /// /// Checks if Web is accessible from This System /// @@ -578,15 +587,15 @@ public static CultureInfo GetCultureInfoByLanguage(Languages language) public static void SaveMediaInfo(int id, string mediaType, string folderPath) { - var filePath = $@"{folderPath}\folicon.folicon"; - InIHelper.AddValue("ID", id.ToString(),null,filePath); + var filePath = Path.Combine(folderPath, GlobalVariables.MediaInfoFile); + InIHelper.AddValue("ID", id.ToString(CultureInfo.InvariantCulture),null,filePath); InIHelper.AddValue("MediaType", mediaType,null,filePath); - Util.HideFile(filePath); + HideFile(filePath); } public static (string ID, string MediaType) ReadMediaInfo(string folderPath) { - var filePath = $@"{folderPath}\folicon.folicon"; + var filePath = Path.Combine(folderPath, GlobalVariables.MediaInfoFile); var id = File.Exists(filePath) ? InIHelper.ReadValue("ID", null, filePath) : null; var mediaType = File.Exists(filePath) ? InIHelper.ReadValue("MediaType", null, filePath) : null; var mediaInfo = (ID:id, MediaType:mediaType); diff --git a/FoliCon/Properties/Langs/Lang.Designer.cs b/FoliCon/Properties/Langs/Lang.Designer.cs index a46407ad..c4c1e247 100644 --- a/FoliCon/Properties/Langs/Lang.Designer.cs +++ b/FoliCon/Properties/Langs/Lang.Designer.cs @@ -267,6 +267,15 @@ public static string ConfirmIconDeletion { } } + /// + /// Looks up a localized string similar to Confirm Media Info files deletion. + /// + public static string ConfirmMediaInfoDeletion { + get { + return ResourceManager.GetString("ConfirmMediaInfoDeletion", resourceCulture); + } + } + /// /// Looks up a localized string similar to Click "Confirm" to open folder.. /// @@ -339,6 +348,34 @@ public static string DeleteIconsTooltip { } } + /// + /// Looks up a localized string similar to Delete media info. + /// + public static string DeleteMediaInfo { + get { + return ResourceManager.GetString("DeleteMediaInfo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to delete folicon media info files ?. + /// + public static string DeleteMediaInfoConfirmation { + get { + return ResourceManager.GetString("DeleteMediaInfoConfirmation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This will delete media info files used by folicon to store media id after a title is selected for the first time. + ///This helps folicon identify media without having to chose from ambigous titles.. + /// + public static string DeleteMediaInfoTooltip { + get { + return ResourceManager.GetString("DeleteMediaInfoTooltip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Developed By Dinesh Solanki.. /// diff --git a/FoliCon/Properties/Langs/Lang.ar.resx b/FoliCon/Properties/Langs/Lang.ar.resx index afcec7d2..fe16d18e 100644 --- a/FoliCon/Properties/Langs/Lang.ar.resx +++ b/FoliCon/Properties/Langs/Lang.ar.resx @@ -499,4 +499,17 @@ حدث استثناء + + تأكيد حذف ملفات معلومات الوسائط + + + حذف معلومات الوسائط + + + هل أنت متأكد أنك تريد حذف ملفات معلومات وسائط فوليكون؟ + + + سيؤدي هذا إلى حذف ملفات معلومات الوسائط التي يستخدمها فوليكون لتخزين معرف الوسائط بعد تحديد العنوان لأول مرة. +يساعد هذا فوليكون في التعرف على الوسائط دون الحاجة إلى الاختيار من بين العناوين الغامضة. + \ No newline at end of file diff --git a/FoliCon/Properties/Langs/Lang.es.resx b/FoliCon/Properties/Langs/Lang.es.resx index 47f3e555..6478979c 100644 --- a/FoliCon/Properties/Langs/Lang.es.resx +++ b/FoliCon/Properties/Langs/Lang.es.resx @@ -499,4 +499,17 @@ y puede buscar "Juegos, películas y programas" y casi cualquier ícono de carpe Ocurrió una excepción + + Confirmar la eliminación de archivos de información multimedia + + + Eliminar información multimedia + + + ¿Está seguro de que desea eliminar los archivos de información de medios de folicon? + + + Esto eliminará los archivos de información de medios utilizados por folicon para almacenar la identificación de medios después de seleccionar un título por primera vez. +Esto ayuda a folicon a identificar los medios sin tener que elegir entre títulos ambiguos. + \ No newline at end of file diff --git a/FoliCon/Properties/Langs/Lang.hi.resx b/FoliCon/Properties/Langs/Lang.hi.resx index 629761e6..d2319533 100644 --- a/FoliCon/Properties/Langs/Lang.hi.resx +++ b/FoliCon/Properties/Langs/Lang.hi.resx @@ -496,4 +496,20 @@ संस्करण : + + मीडिया इन्फो फ़ाइलों को हटाने की पुष्टि करें + + + मीडिया जानकारी हटाएं + + + क्या आप वाकई फ़ॉलिकॉन मीडिया जानकारी फ़ाइलें हटाना चाहते हैं? + + + यह पहली बार किसी शीर्षक के चयन के बाद मीडिया आईडी को स्टोर करने के लिए फॉलिकॉन द्वारा उपयोग की जाने वाली मीडिया जानकारी फ़ाइलों को हटा देगा। +यह अस्पष्ट शीर्षकों में से चुने बिना फॉलिकॉन को मीडिया की पहचान करने में मदद करता है। + + + त्रुटी + \ No newline at end of file diff --git a/FoliCon/Properties/Langs/Lang.resx b/FoliCon/Properties/Langs/Lang.resx index ce1a4e0d..aabcb2e9 100644 --- a/FoliCon/Properties/Langs/Lang.resx +++ b/FoliCon/Properties/Langs/Lang.resx @@ -186,6 +186,9 @@ Confirm Icon Deletion + + Confirm Media Info files deletion + Click "Confirm" to open folder. @@ -210,6 +213,16 @@ This will delete existing icons from all subFolders. + + Delete media info + + + Are you sure you want to delete folicon media info files ? + + + This will delete media info files used by folicon to store media id after a title is selected for the first time. +This helps folicon identify media without having to chose from ambigous titles. + Developed By Dinesh Solanki. diff --git a/FoliCon/Properties/Langs/Lang.ru.resx b/FoliCon/Properties/Langs/Lang.ru.resx index 2acd1282..8a8420e7 100644 --- a/FoliCon/Properties/Langs/Lang.ru.resx +++ b/FoliCon/Properties/Langs/Lang.ru.resx @@ -499,4 +499,17 @@ Произошло исключение + + Подтвердите удаление файлов Media Info + + + Удалить информацию о мультимедиа + + + Вы уверены, что хотите удалить информационные файлы мультимедиа Folicon? + + + Это приведет к удалению файлов информации о мультимедиа, используемых folicon для хранения идентификатора мультимедиа после выбора заголовка в первый раз. +Это помогает фоликону идентифицировать носители без необходимости выбирать из двусмысленных названий. + \ No newline at end of file diff --git a/FoliCon/ViewModels/MainWindowViewModel.cs b/FoliCon/ViewModels/MainWindowViewModel.cs index 090350b8..bc9e1f66 100644 --- a/FoliCon/ViewModels/MainWindowViewModel.cs +++ b/FoliCon/ViewModels/MainWindowViewModel.cs @@ -176,6 +176,7 @@ public Languages AppLanguage public DelegateCommand CustomIconsCommand { get; private set; } public DelegateCommand DeleteIconsCommand { get; private set; } + public DelegateCommand DeleteMediaInfoCommand { get; private set; } public DelegateCommand HelpCommand { get; } = new(() => Util.StartProcess("https://github.com/DineshSolanki/FoliCon")); @@ -437,6 +438,7 @@ private void InitializeDelegates() PosterIconConfigCommand = new DelegateCommand(delegate { _dialogService.ShowPosterIconConfig(_ => { }); }); AboutCommand = new DelegateCommand(AboutMethod); DeleteIconsCommand = new DelegateCommand(DeleteIconsMethod); + DeleteMediaInfoCommand = new DelegateCommand(DeleteMediaInfo); CustomIconsCommand = new DelegateCommand(delegate { _dialogService.ShowCustomIconWindow( @@ -466,6 +468,23 @@ private void InitializeDelegates() }); } + private void DeleteMediaInfo() + { + if (Directory.Exists(SelectedFolder)) + { + if (MessageBox.Show(CustomMessageBox.Ask(LangProvider.GetLang("DeleteMediaInfoConfirmation"), + LangProvider.GetLang("ConfirmMediaInfoDeletion"))) == System.Windows.MessageBoxResult.Yes) + { + Util.DeleteMediaInfoFromSubfolders(SelectedFolder); + } + } + else + { + MessageBox.Show(CustomMessageBox.Error(LangProvider.GetLang("DirectoryIsEmpty"), + LangProvider.GetLang("EmptyDirectory"))); + } + } + private void InitializeProperties() { Fnames = new List(); diff --git a/FoliCon/Views/MainWindow.xaml b/FoliCon/Views/MainWindow.xaml index 1f64ada1..923ecaf2 100644 --- a/FoliCon/Views/MainWindow.xaml +++ b/FoliCon/Views/MainWindow.xaml @@ -78,6 +78,9 @@ + diff --git a/Folicon.sln.DotSettings b/Folicon.sln.DotSettings new file mode 100644 index 00000000..c09c5b1d --- /dev/null +++ b/Folicon.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file