diff --git a/FoliCon/Modules/LangProvider.cs b/FoliCon/Modules/LangProvider.cs index 954134ed..95d1c1ab 100644 --- a/FoliCon/Modules/LangProvider.cs +++ b/FoliCon/Modules/LangProvider.cs @@ -161,6 +161,7 @@ private void UpdateLangs() OnPropertyChanged(nameof(UsePosterOverlay)); OnPropertyChanged(nameof(Version)); OnPropertyChanged(nameof(Year)); + OnPropertyChanged(nameof(ExceptionOccurred)); } public string About => Lang.About; @@ -410,6 +411,7 @@ private void UpdateLangs() public string Version => Lang.Version; public string Year => Lang.Year; + public string ExceptionOccurred => Lang.ExceptionOccurred; public event PropertyChangedEventHandler PropertyChanged; @@ -668,5 +670,7 @@ public class LangKeys public static string Year = nameof(Year); + public static string ExceptionOccurred = nameof(ExceptionOccurred); + } } \ No newline at end of file diff --git a/FoliCon/Modules/Util.cs b/FoliCon/Modules/Util.cs index 2e44d3a5..c6f784be 100644 --- a/FoliCon/Modules/Util.cs +++ b/FoliCon/Modules/Util.cs @@ -220,7 +220,6 @@ public static List GetFolderNames(string folderPath) where !File.Exists(folder + @"\" + Path.GetFileName(folder) + ".ico") select Path.GetFileName(folder)); } - return folderNames; } @@ -315,8 +314,16 @@ public static ObservableCollection FetchAndAddDetailsToListView(Result public static List GetFileNamesFromFolder(string folder) { var itemList = new List(); - if (string.IsNullOrEmpty(folder)) return itemList; - itemList.AddRange(Directory.GetFiles(folder).Select(Path.GetFileName)); + try + { + if (string.IsNullOrEmpty(folder)) return itemList; + itemList.AddRange(Directory.GetFiles(folder).Select(Path.GetFileName)); + } + catch (Exception e) + { + itemList.Add($"Error accessing files: {e.Message}"); + } + return itemList; } diff --git a/FoliCon/Properties/Langs/Lang.Designer.cs b/FoliCon/Properties/Langs/Lang.Designer.cs index 8f96b21b..a46407ad 100644 --- a/FoliCon/Properties/Langs/Lang.Designer.cs +++ b/FoliCon/Properties/Langs/Lang.Designer.cs @@ -411,6 +411,15 @@ public static string EnterTitlePlaceholder { } } + /// + /// Looks up a localized string similar to Exception Occurred. + /// + public static string ExceptionOccurred { + get { + return ResourceManager.GetString("ExceptionOccurred", resourceCulture); + } + } + /// /// Looks up a localized string similar to Folder. /// diff --git a/FoliCon/Properties/Langs/Lang.ar.resx b/FoliCon/Properties/Langs/Lang.ar.resx index caeb7165..afcec7d2 100644 --- a/FoliCon/Properties/Langs/Lang.ar.resx +++ b/FoliCon/Properties/Langs/Lang.ar.resx @@ -496,4 +496,7 @@ إصدار : + + حدث استثناء + \ No newline at end of file diff --git a/FoliCon/Properties/Langs/Lang.es.resx b/FoliCon/Properties/Langs/Lang.es.resx index 9fc8803f..47f3e555 100644 --- a/FoliCon/Properties/Langs/Lang.es.resx +++ b/FoliCon/Properties/Langs/Lang.es.resx @@ -496,4 +496,7 @@ y puede buscar "Juegos, películas y programas" y casi cualquier ícono de carpe Versión : + + Ocurrió una excepción + \ No newline at end of file diff --git a/FoliCon/Properties/Langs/Lang.resx b/FoliCon/Properties/Langs/Lang.resx index eeb87137..ce1a4e0d 100644 --- a/FoliCon/Properties/Langs/Lang.resx +++ b/FoliCon/Properties/Langs/Lang.resx @@ -234,6 +234,9 @@ Please Enter Title here to search again. + + Exception Occurred + Folder diff --git a/FoliCon/Properties/Langs/Lang.ru.resx b/FoliCon/Properties/Langs/Lang.ru.resx index 295aa0eb..2acd1282 100644 --- a/FoliCon/Properties/Langs/Lang.ru.resx +++ b/FoliCon/Properties/Langs/Lang.ru.resx @@ -496,4 +496,7 @@ Версия: + + Произошло исключение + \ No newline at end of file diff --git a/FoliCon/ViewModels/MainWindowViewModel.cs b/FoliCon/ViewModels/MainWindowViewModel.cs index ef693ebe..cd9242fe 100644 --- a/FoliCon/ViewModels/MainWindowViewModel.cs +++ b/FoliCon/ViewModels/MainWindowViewModel.cs @@ -282,7 +282,7 @@ private async void SearchAndMakeMethod() } catch (Exception e) { - MessageBox.Show(CustomMessageBox.Error(e.Message, "Exception Occurred")); + MessageBox.Show(CustomMessageBox.Error(e.Message, LangProvider.GetLang("ExceptionOccurred"))); StatusBarProperties.ResetData(); IsMakeEnabled = true; }