From 8ab08ac1201512cfc477cdda58bf56813093e82f Mon Sep 17 00:00:00 2001 From: Dinesh Solanki <15937452+dineshsolanki@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:00:00 +0530 Subject: [PATCH] Add Localizable attribute and improve encapsulation Added the `[Localizable(false)]` attribute to various classes to exclude them from localization. Improved encapsulation by modifying access modifiers for properties and fields, ensuring private or protected access where appropriate. These changes help in better resource management and code maintainability. --- FoliCon/Models/Constants/GlobalVariables.cs | 2 +- FoliCon/Modules/Configuration/AssemblyInfo.cs | 1 + .../BoolToPermissionTextConvertor.cs | 1 + .../Modules/Convertor/ImageCacheConverter.cs | 1 + FoliCon/Modules/DeviantArt/DArt.cs | 15 +++++------ .../Extension/BindingPathExtensions.cs | 1 + .../Extension/DialogServiceExtensions.cs | 1 + FoliCon/Modules/Extension/Extensions.cs | 1 + FoliCon/Modules/Extension/StreamExtension.cs | 1 + FoliCon/Modules/IGDB/IgdbDataTransformer.cs | 1 + FoliCon/Modules/IGDB/IgdbService.cs | 3 ++- FoliCon/Modules/LangProvider.cs | 1 + FoliCon/Modules/Media/PngToIcoService.cs | 1 + FoliCon/Modules/TMDB/TMDBService.cs | 5 ++-- FoliCon/Modules/UI/CustomMessageBox.cs | 1 + FoliCon/Modules/UI/FolderDragDropHelper.cs | 2 +- FoliCon/Modules/UI/HandyWindow.cs | 1 + .../Modules/UI/ListViewClickSortBehavior.cs | 2 +- FoliCon/Modules/utils/CultureUtils.cs | 25 ++++++++++--------- FoliCon/Modules/utils/DataUtils.cs | 5 ++-- FoliCon/Modules/utils/DialogUtils.cs | 5 +--- FoliCon/Modules/utils/StaTask.cs | 1 + FoliCon/Modules/utils/TitleCleaner.cs | 1 + FoliCon/ViewModels/AboutBoxViewModel.cs | 1 + .../ViewModels/ApiConfigurationViewModel.cs | 2 +- .../ViewModels/CustomIconControlViewModel.cs | 13 +++++----- FoliCon/ViewModels/DialogControlViewModel.cs | 6 ++--- FoliCon/ViewModels/MainWindowViewModel.cs | 18 ++++++------- FoliCon/ViewModels/ManualExplorerViewModel.cs | 7 +++--- FoliCon/ViewModels/PosterPickerViewModel.cs | 6 +++-- FoliCon/ViewModels/PreviewerViewModel.cs | 3 ++- .../ViewModels/ProSearchResultViewModel.cs | 14 ++++++----- FoliCon/ViewModels/SearchResultViewModel.cs | 3 ++- .../ViewModels/posterIconConfigViewModel.cs | 3 ++- FoliCon/Views/HtmlBox.xaml.cs | 9 ++++--- FoliCon/Views/ImageGalleryControl.xaml.cs | 1 + 36 files changed, 97 insertions(+), 67 deletions(-) diff --git a/FoliCon/Models/Constants/GlobalVariables.cs b/FoliCon/Models/Constants/GlobalVariables.cs index ddb51fa4..02282b24 100644 --- a/FoliCon/Models/Constants/GlobalVariables.cs +++ b/FoliCon/Models/Constants/GlobalVariables.cs @@ -17,7 +17,7 @@ public static IconOverlay IconOverlayType() }; } - public static readonly string MediaInfoFile = "info.folicon"; + public const string MediaInfoFile = "info.folicon"; private static string IconOverlayTypeString => Services.Tracker.Store.GetData("PosterIconConfigViewModel")["p.IconOverlay"].ToString(); diff --git a/FoliCon/Modules/Configuration/AssemblyInfo.cs b/FoliCon/Modules/Configuration/AssemblyInfo.cs index 8e0bafc8..f5100b68 100644 --- a/FoliCon/Modules/Configuration/AssemblyInfo.cs +++ b/FoliCon/Modules/Configuration/AssemblyInfo.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.Configuration; +[Localizable(false)] internal static class AssemblyInfo { public static string GetVersion() diff --git a/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs b/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs index a3ac52cf..4161aa4b 100644 --- a/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs +++ b/FoliCon/Modules/Convertor/BoolToPermissionTextConvertor.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.Convertor; +[Localizable(false)] public class BoolToPermissionTextConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/FoliCon/Modules/Convertor/ImageCacheConverter.cs b/FoliCon/Modules/Convertor/ImageCacheConverter.cs index 5c3b9c63..8ca7217b 100644 --- a/FoliCon/Modules/Convertor/ImageCacheConverter.cs +++ b/FoliCon/Modules/Convertor/ImageCacheConverter.cs @@ -4,6 +4,7 @@ /// Converts an image path to a BitmapImage with caching to improve performance and thread safety. /// CREDIT: https://stackoverflow.com/a/37652158/8076598 /// +[Localizable(false)] public class ImageCacheConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/FoliCon/Modules/DeviantArt/DArt.cs b/FoliCon/Modules/DeviantArt/DArt.cs index 6ad9a4bd..64506d8d 100644 --- a/FoliCon/Modules/DeviantArt/DArt.cs +++ b/FoliCon/Modules/DeviantArt/DArt.cs @@ -2,29 +2,30 @@ namespace FoliCon.Modules.DeviantArt; +[Localizable(false)] public class DArt : BindableBase { private string _clientAccessToken; private string _clientSecret; - private string _clientId; + private readonly string _clientId; private readonly MemoryCache _cache = new(new MemoryCacheOptions()); private static readonly JsonSerializerSettings SerializerSettings = new() { NullValueHandling = NullValueHandling.Ignore }; - - public string ClientId + + private string ClientId { get => _clientId; - set => SetProperty(ref _clientId, value); + init => SetProperty(ref _clientId, value); } - public string ClientSecret + private string ClientSecret { get => _clientSecret; - set => SetProperty(ref _clientSecret, value); + init => SetProperty(ref _clientSecret, value); } - public string ClientAccessToken + private string ClientAccessToken { get => _clientAccessToken; set => SetProperty(ref _clientAccessToken, value); diff --git a/FoliCon/Modules/Extension/BindingPathExtensions.cs b/FoliCon/Modules/Extension/BindingPathExtensions.cs index 7cc39126..c9fa977c 100644 --- a/FoliCon/Modules/Extension/BindingPathExtensions.cs +++ b/FoliCon/Modules/Extension/BindingPathExtensions.cs @@ -2,6 +2,7 @@ namespace FoliCon.Modules.Extension; +[Localizable(false)] public static class BindingPathExtensions { private static readonly ImageCacheConverter ImageCacheConverter = new (); diff --git a/FoliCon/Modules/Extension/DialogServiceExtensions.cs b/FoliCon/Modules/Extension/DialogServiceExtensions.cs index fa76cc38..94626a58 100644 --- a/FoliCon/Modules/Extension/DialogServiceExtensions.cs +++ b/FoliCon/Modules/Extension/DialogServiceExtensions.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.Extension; +[Localizable(false)] public static class DialogServiceExtensions { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); diff --git a/FoliCon/Modules/Extension/Extensions.cs b/FoliCon/Modules/Extension/Extensions.cs index 1b7af176..97b8d489 100644 --- a/FoliCon/Modules/Extension/Extensions.cs +++ b/FoliCon/Modules/Extension/Extensions.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.Extension; +[Localizable(false)] public static class Extensions { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); diff --git a/FoliCon/Modules/Extension/StreamExtension.cs b/FoliCon/Modules/Extension/StreamExtension.cs index 06857cf7..616bc4e0 100644 --- a/FoliCon/Modules/Extension/StreamExtension.cs +++ b/FoliCon/Modules/Extension/StreamExtension.cs @@ -5,6 +5,7 @@ namespace FoliCon.Modules.Extension; +[Localizable(false)] public static class StreamExtensions { private static readonly ReaderOptions ReaderOptions = new() { ArchiveEncoding = diff --git a/FoliCon/Modules/IGDB/IgdbDataTransformer.cs b/FoliCon/Modules/IGDB/IgdbDataTransformer.cs index 9e2268ca..59cf4c58 100644 --- a/FoliCon/Modules/IGDB/IgdbDataTransformer.cs +++ b/FoliCon/Modules/IGDB/IgdbDataTransformer.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.IGDB; +[Localizable(false)] public class IgdbDataTransformer(ref List listDataTable, ref List imgDownloadList) { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); diff --git a/FoliCon/Modules/IGDB/IgdbService.cs b/FoliCon/Modules/IGDB/IgdbService.cs index 2eb6fc36..698c6f2e 100644 --- a/FoliCon/Modules/IGDB/IgdbService.cs +++ b/FoliCon/Modules/IGDB/IgdbService.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.IGDB; +[Localizable(false)] public class IgdbService(ref IGDBClient serviceClient) { private const string ServiceClientIsNotInitialized = "Service Client is not initialized."; @@ -19,7 +20,7 @@ public async Task SearchGameAsync(string query) } var r = await _serviceClient.QueryAsync(IGDBClient.Endpoints.Games, - $"search \"{query}\"; fields artworks.image_id, name,first_release_date,total_rating,summary,cover.*;"); + $"""search "{query}"; fields artworks.image_id, name,first_release_date,total_rating,summary,cover.*;"""); return new ResultResponse { diff --git a/FoliCon/Modules/LangProvider.cs b/FoliCon/Modules/LangProvider.cs index 591de4d3..ebd6986e 100644 --- a/FoliCon/Modules/LangProvider.cs +++ b/FoliCon/Modules/LangProvider.cs @@ -2,6 +2,7 @@ namespace FoliCon.Properties.Langs; +[Localizable(false)] public class LangProvider : INotifyPropertyChanged { private static string _cultureInfoStr; diff --git a/FoliCon/Modules/Media/PngToIcoService.cs b/FoliCon/Modules/Media/PngToIcoService.cs index bf4c4082..e12c9c7b 100644 --- a/FoliCon/Modules/Media/PngToIcoService.cs +++ b/FoliCon/Modules/Media/PngToIcoService.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.Media; +[Localizable(false)] public static class PngToIcoService { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); diff --git a/FoliCon/Modules/TMDB/TMDBService.cs b/FoliCon/Modules/TMDB/TMDBService.cs index 1abab68b..75d0a03b 100644 --- a/FoliCon/Modules/TMDB/TMDBService.cs +++ b/FoliCon/Modules/TMDB/TMDBService.cs @@ -3,6 +3,7 @@ namespace FoliCon.Modules.TMDB; +[Localizable(false)] internal class TmdbService { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -114,8 +115,8 @@ public async Task SearchWithParamsAsync(ParsedTitle parsedTitle, { Logger.Debug("Searching for {ParsedTitle} in {SearchMode}", parsedTitle, searchMode); - var mediaType = ""; - object? searchResult = null; + string mediaType; + object? searchResult; switch (searchMode) { diff --git a/FoliCon/Modules/UI/CustomMessageBox.cs b/FoliCon/Modules/UI/CustomMessageBox.cs index a50314b7..f03a8661 100644 --- a/FoliCon/Modules/UI/CustomMessageBox.cs +++ b/FoliCon/Modules/UI/CustomMessageBox.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.UI; +[Localizable(false)] internal static class CustomMessageBox { public static MessageBoxInfo Ask(string messageBoxText, string caption) diff --git a/FoliCon/Modules/UI/FolderDragDropHelper.cs b/FoliCon/Modules/UI/FolderDragDropHelper.cs index 9cd1e234..6c99f37b 100644 --- a/FoliCon/Modules/UI/FolderDragDropHelper.cs +++ b/FoliCon/Modules/UI/FolderDragDropHelper.cs @@ -59,7 +59,7 @@ private static void Control_DragOver(object sender, DragEventArgs e) var dt = e.Data.GetData(DataFormats.FileDrop); var data = (dt as Array)?.GetValue(0)?.ToString(); - Logger.Trace("Control_DragOver: Data: {Data}", data ?? "null"); + Logger.Trace("Control_DragOver: Data: {Data}", data); e.Effects = Directory.Exists(data) ? DragDropEffects.Link : DragDropEffects.None; e.Handled = true; diff --git a/FoliCon/Modules/UI/HandyWindow.cs b/FoliCon/Modules/UI/HandyWindow.cs index de5d93b0..fc682887 100644 --- a/FoliCon/Modules/UI/HandyWindow.cs +++ b/FoliCon/Modules/UI/HandyWindow.cs @@ -3,6 +3,7 @@ namespace FoliCon.Modules.UI; +[Localizable(false)] public class HandyWindow : Window, IDialogWindow { static HandyWindow() diff --git a/FoliCon/Modules/UI/ListViewClickSortBehavior.cs b/FoliCon/Modules/UI/ListViewClickSortBehavior.cs index 56e5b4d4..421c1e72 100644 --- a/FoliCon/Modules/UI/ListViewClickSortBehavior.cs +++ b/FoliCon/Modules/UI/ListViewClickSortBehavior.cs @@ -62,7 +62,7 @@ private void OnClick(object sender, RoutedEventArgs e) ? Application.Current.Resources["HeaderTemplateArrowUp"] as DataTemplate : Application.Current.Resources["HeaderTemplateArrowDown"] as DataTemplate; - // Remove arrow from previously sorted header + // Remove arrow from the previously sorted header if (_lastHeaderClicked != null && _lastHeaderClicked != headerClicked) { _lastHeaderClicked.Column.HeaderTemplate = null; diff --git a/FoliCon/Modules/utils/CultureUtils.cs b/FoliCon/Modules/utils/CultureUtils.cs index 1b3a98fd..8a2a51b9 100644 --- a/FoliCon/Modules/utils/CultureUtils.cs +++ b/FoliCon/Modules/utils/CultureUtils.cs @@ -1,24 +1,25 @@ namespace FoliCon.Modules.utils; +[Localizable(false)] public static class CultureUtils { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + private static readonly Dictionary LanguageCodes = new() + { + { Languages.English, "en-US" }, + { Languages.Spanish, "es-MX" }, + { Languages.Arabic, "ar-SA" }, + { Languages.Russian, "ru-RU" }, + { Languages.Hindi, "hi-IN" }, + { Languages.Portuguese, "pt-PT" } + }; + public static CultureInfo GetCultureInfoByLanguage(Languages language) { Logger.Debug("Getting CultureInfo by Language: {Language}", language); - - var languageCodes = new Dictionary - { - { Languages.English, "en-US" }, - { Languages.Spanish, "es-MX" }, - { Languages.Arabic, "ar-SA" }, - { Languages.Russian, "ru-RU" }, - { Languages.Hindi, "hi-IN" }, - { Languages.Portuguese, "pt-PT" } - }; - - var langCode = languageCodes.GetValueOrDefault(language, "en-US"); + + var langCode = LanguageCodes.GetValueOrDefault(language, "en-US"); ConfigHelper.Instance.SetLang(langCode.Split("-")[0]); return new CultureInfo(langCode); diff --git a/FoliCon/Modules/utils/DataUtils.cs b/FoliCon/Modules/utils/DataUtils.cs index cb4c1f67..6c3d65a1 100644 --- a/FoliCon/Modules/utils/DataUtils.cs +++ b/FoliCon/Modules/utils/DataUtils.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.utils; +[Localizable(false)] public static class DataUtils { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -24,10 +25,10 @@ public static int GetResultCount(bool isPickedById, dynamic result, string searc /// Formatted Rating value. public static string FormatRating(double ratingInput) { - Logger.Debug("Start FormatRatingString() - Input received : {RatingInput}", ratingInput); + Logger.Trace("Start FormatRatingString() - Input received : {RatingInput}", ratingInput); var decimalPart = ratingInput % 1; var formattedRatingValue = decimalPart > 0 ? ratingInput.ToString("0.##") : ratingInput.ToString("0"); - Logger.Debug("End FormatRatingString() - Formatted Rating : {FormattedRatingValue}", formattedRatingValue); + Logger.Trace("End FormatRatingString() - Formatted Rating : {FormattedRatingValue}", formattedRatingValue); return formattedRatingValue; } diff --git a/FoliCon/Modules/utils/DialogUtils.cs b/FoliCon/Modules/utils/DialogUtils.cs index 2ab82d8f..860a3121 100644 --- a/FoliCon/Modules/utils/DialogUtils.cs +++ b/FoliCon/Modules/utils/DialogUtils.cs @@ -54,10 +54,7 @@ public static VistaFolderBrowserDialog NewFolderBrowserDialog(string description }; return folderBrowser; } - public static VistaOpenFileDialog NewOpenFileDialog(string description) - { - return NewOpenFileDialog(description, "All files (*.*)|*.*"); - } + public static VistaOpenFileDialog NewOpenFileDialog(string description, string filter) { Logger.Debug("Creating New Open File Dialog"); diff --git a/FoliCon/Modules/utils/StaTask.cs b/FoliCon/Modules/utils/StaTask.cs index c884f12c..d94b8e4c 100644 --- a/FoliCon/Modules/utils/StaTask.cs +++ b/FoliCon/Modules/utils/StaTask.cs @@ -1,6 +1,7 @@ namespace FoliCon.Modules.utils; //Taken from-https://stackoverflow.com/a/16722767/8076598 +[Localizable(false)] public static class StaTask { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); diff --git a/FoliCon/Modules/utils/TitleCleaner.cs b/FoliCon/Modules/utils/TitleCleaner.cs index 90c79e44..00d9b2c2 100644 --- a/FoliCon/Modules/utils/TitleCleaner.cs +++ b/FoliCon/Modules/utils/TitleCleaner.cs @@ -1,5 +1,6 @@ namespace FoliCon.Modules.utils; +[Localizable(false)] internal static class TitleCleaner { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); diff --git a/FoliCon/ViewModels/AboutBoxViewModel.cs b/FoliCon/ViewModels/AboutBoxViewModel.cs index b7d5b432..08118036 100644 --- a/FoliCon/ViewModels/AboutBoxViewModel.cs +++ b/FoliCon/ViewModels/AboutBoxViewModel.cs @@ -1,5 +1,6 @@ namespace FoliCon.ViewModels; +[Localizable(false)] public class AboutBoxViewModel : BindableBase, IDialogAware { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); diff --git a/FoliCon/ViewModels/ApiConfigurationViewModel.cs b/FoliCon/ViewModels/ApiConfigurationViewModel.cs index 99d49383..cbcdc11f 100644 --- a/FoliCon/ViewModels/ApiConfigurationViewModel.cs +++ b/FoliCon/ViewModels/ApiConfigurationViewModel.cs @@ -2,7 +2,7 @@ public class ApiConfigurationViewModel : BindableBase, IDialogAware { - private string _title = "API Configuration"; + private string _title = Lang.APIKeysConfiguration; private string _dartClient; private string _dartClientId; private string _tmdbKey; diff --git a/FoliCon/ViewModels/CustomIconControlViewModel.cs b/FoliCon/ViewModels/CustomIconControlViewModel.cs index 748a9342..4fcdf184 100644 --- a/FoliCon/ViewModels/CustomIconControlViewModel.cs +++ b/FoliCon/ViewModels/CustomIconControlViewModel.cs @@ -4,6 +4,7 @@ namespace FoliCon.ViewModels; +[Localizable(false)] public class CustomIconControlViewModel : BindableBase, IDialogAware, IFileDragDropTarget { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -54,7 +55,7 @@ public bool IsUndoEnable set => SetProperty(ref _isUndoEnable, value); } - public string SelectedDirectory + private string SelectedDirectory { get => _selectedDirectory; set @@ -69,7 +70,7 @@ public string SelectedDirectory } } - public string SelectedIconsDirectory + private string SelectedIconsDirectory { get => _selectedIconsDirectory; set @@ -88,17 +89,17 @@ public string SelectedIconsDirectory public ObservableCollection Directories { get => _directories; - set => SetProperty(ref _directories, value); + private set => SetProperty(ref _directories, value); } public ObservableCollection Icons { get => _icons; - set => SetProperty(ref _icons, value); + private set => SetProperty(ref _icons, value); } public int Index { get => _index; set => SetProperty(ref _index, value); } public int TotalIcons { get => _totalIcons; set => SetProperty(ref _totalIcons, value); } - public bool StopSearch { get => _stopSearch; set => SetProperty(ref _stopSearch, value); } + private bool StopSearch { get => _stopSearch; set => SetProperty(ref _stopSearch, value); } #region Declare Delegates public DelegateCommand LoadDirectory { get; set; } @@ -201,7 +202,7 @@ protected virtual void CloseDialog(string parameter) RaiseRequestClose(new DialogResult(result)); } - public virtual void RaiseRequestClose(IDialogResult dialogResult) => + protected virtual void RaiseRequestClose(IDialogResult dialogResult) => RequestClose?.Invoke(dialogResult); public virtual bool CanCloseDialog() => true; diff --git a/FoliCon/ViewModels/DialogControlViewModel.cs b/FoliCon/ViewModels/DialogControlViewModel.cs index c2a1e952..1f3ee5c0 100644 --- a/FoliCon/ViewModels/DialogControlViewModel.cs +++ b/FoliCon/ViewModels/DialogControlViewModel.cs @@ -13,7 +13,7 @@ public class DialogControlViewModel : BindableBase, IDialogAware public string Message { get => _message; - set => SetProperty(ref _message, value); + private set => SetProperty(ref _message, value); } private string _title = "Notification"; @@ -21,7 +21,7 @@ public string Message public string Title { get => _title; - set => SetProperty(ref _title, value); + private set => SetProperty(ref _title, value); } public event Action RequestClose; @@ -39,7 +39,7 @@ protected virtual void CloseDialog(string parameter) RaiseRequestClose(new DialogResult(result)); } - public virtual void RaiseRequestClose(IDialogResult dialogResult) + protected virtual void RaiseRequestClose(IDialogResult dialogResult) { RequestClose?.Invoke(dialogResult); } diff --git a/FoliCon/ViewModels/MainWindowViewModel.cs b/FoliCon/ViewModels/MainWindowViewModel.cs index fd9d28b6..f4866703 100644 --- a/FoliCon/ViewModels/MainWindowViewModel.cs +++ b/FoliCon/ViewModels/MainWindowViewModel.cs @@ -62,7 +62,7 @@ public bool IsSearchModeVisible public ListViewData FinalListViewData { get => _finalListViewData; - set => SetProperty(ref _finalListViewData, value); + private set => SetProperty(ref _finalListViewData, value); } private readonly IDialogService _dialogService; @@ -70,7 +70,7 @@ public ListViewData FinalListViewData private DirectoryPermissionsResult _directoryPermissionResult; public StatusBarData StatusBarProperties { get; set; } public ProgressBarData BusyIndicatorProperties { get => _busyIndicatorProperties; set => SetProperty(ref _busyIndicatorProperties, value); } - public List Fnames { get; set; } = []; + private List Fnames { get; set; } = []; public bool IsMakeEnabled { @@ -84,13 +84,13 @@ public bool IsSkipAmbiguous set => SetProperty(ref _isSkipAmbiguous, value); } - public bool StopIconDownload + private bool StopIconDownload { get => _stopIconDownload; set => SetProperty(ref _stopIconDownload, value); } - public string IconMode + private string IconMode { get => _iconMode; set @@ -100,7 +100,7 @@ public string IconMode } } - public string SearchMode + private string SearchMode { get => _searchMode; set => SetProperty(ref _searchMode, value); @@ -405,7 +405,7 @@ private async Task ProcessPosterModeAsync() IsMakeEnabled = false; await ProcessPosterFolderAsync(SelectedFolder); - StatusBarProperties.AppStatus = "Idle"; + StatusBarProperties.AppStatus = Lang.Idle; StatusBarProperties.AppStatusAdditional = ""; } @@ -497,7 +497,7 @@ private static void ProcessSubfolders(string folderPath, Queue folderQue private async Task<(ResultResponse response, ParsedTitle parsedTitle, bool isPickedById, string mediaType)> PerformPreprocessing(string itemTitle, string fullFolderPath) { - StatusBarProperties.AppStatus = "Searching"; + StatusBarProperties.AppStatus = Lang.Searching; StatusBarProperties.AppStatusAdditional = itemTitle; var parsedTitle = TitleCleaner.CleanAndParse(itemTitle); var (id, mediaType) = FileUtils.ReadMediaInfo(fullFolderPath); @@ -652,7 +652,7 @@ private void ProcessProfessionalMode(string initialFolderPath) continue; } StatusBarProperties.TotalFolders+= subfolderNames.Count; - StatusBarProperties.AppStatus = "Searching"; + StatusBarProperties.AppStatus = Lang.Searching; _dialogService.ShowProSearchResult(folderPath, subfolderNames, _pickedListDataTable, _imgDownloadList, _dArtObject, _ => { }); Logger.Debug("ProcessProfessionalMode: found {ResultCount} results, adding to final list", _pickedListDataTable.Count); @@ -867,7 +867,7 @@ private async Task StartDownloadingAsync() IsMakeEnabled = false; StatusBarProperties.AppStatus = LangProvider.GetLang("Creating Icons"); await DownloadAndMakeIconsAsync(); - StatusBarProperties.AppStatus = "Idle"; + StatusBarProperties.AppStatus = Lang.Idle; StatusBarProperties.AppStatusAdditional = ""; } diff --git a/FoliCon/ViewModels/ManualExplorerViewModel.cs b/FoliCon/ViewModels/ManualExplorerViewModel.cs index 70543023..1eec5dd4 100644 --- a/FoliCon/ViewModels/ManualExplorerViewModel.cs +++ b/FoliCon/ViewModels/ManualExplorerViewModel.cs @@ -1,5 +1,6 @@ namespace FoliCon.ViewModels; +[Localizable(false)] public class ManualExplorerViewModel : BindableBase, IDialogAware { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -28,9 +29,9 @@ private void PickMethod(object localImagePath) public string Title { get => _title; set => SetProperty(ref _title, value); } public bool IsBusy { get => _isBusy; set => SetProperty(ref _isBusy, value); } - public DArt DArtObject { get => _dArtObject; set => SetProperty(ref _dArtObject, value); } + private DArt DArtObject { get => _dArtObject; set => SetProperty(ref _dArtObject, value); } public ProgressBarData ProgressInfo { get => _progressInfo; set => SetProperty(ref _progressInfo, value); } - public DArtDownloadResponse DArtDownloadResponse { get => _dArtDownloadResponse; set => SetProperty(ref _dArtDownloadResponse, value); } + private DArtDownloadResponse DArtDownloadResponse { get => _dArtDownloadResponse; set => SetProperty(ref _dArtDownloadResponse, value); } public ObservableCollection Directory { get => _directory; set => SetProperty(ref _directory, value); } public DelegateCommand PickCommand { get; set; } @@ -68,7 +69,7 @@ protected virtual void CloseDialog(ButtonResult result, string localPath) RaiseRequestClose(new DialogResult(result, dialogParams)); } - public virtual void RaiseRequestClose(IDialogResult dialogResult) + protected virtual void RaiseRequestClose(IDialogResult dialogResult) { RequestClose?.Invoke(dialogResult); } diff --git a/FoliCon/ViewModels/PosterPickerViewModel.cs b/FoliCon/ViewModels/PosterPickerViewModel.cs index f8f6ef35..2f0f19a9 100644 --- a/FoliCon/ViewModels/PosterPickerViewModel.cs +++ b/FoliCon/ViewModels/PosterPickerViewModel.cs @@ -3,6 +3,7 @@ namespace FoliCon.ViewModels; +[Localizable(false)] public class PosterPickerViewModel : BindableBase, IDialogAware { private const string PosterPathMessage = "Poster Path: {PosterPath}"; @@ -68,7 +69,7 @@ protected virtual void CloseDialog(string parameter) RaiseRequestClose(new DialogResult(result)); } - public virtual void RaiseRequestClose(IDialogResult dialogResult) + protected virtual void RaiseRequestClose(IDialogResult dialogResult) { RequestClose?.Invoke(dialogResult); } @@ -93,7 +94,8 @@ public void OnDialogOpened(IDialogParameters parameters) LoadData(); } - public async Task LoadData() + + private async Task LoadData() { var resultType = _result.MediaType; var response = GetResponse(resultType); diff --git a/FoliCon/ViewModels/PreviewerViewModel.cs b/FoliCon/ViewModels/PreviewerViewModel.cs index 95129fcf..806e547a 100644 --- a/FoliCon/ViewModels/PreviewerViewModel.cs +++ b/FoliCon/ViewModels/PreviewerViewModel.cs @@ -1,5 +1,6 @@ namespace FoliCon.ViewModels { + [Localizable(false)] public class PreviewerViewModel : BindableBase, IDialogAware { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -25,7 +26,7 @@ public PreviewerViewModel() public PosterIcon PosterIconInstance { get => _posterIconInstance; - set => SetProperty(ref _posterIconInstance, value); + private set => SetProperty(ref _posterIconInstance, value); } public string Rating { diff --git a/FoliCon/ViewModels/ProSearchResultViewModel.cs b/FoliCon/ViewModels/ProSearchResultViewModel.cs index 18bfa543..a8e85446 100644 --- a/FoliCon/ViewModels/ProSearchResultViewModel.cs +++ b/FoliCon/ViewModels/ProSearchResultViewModel.cs @@ -2,6 +2,7 @@ namespace FoliCon.ViewModels; +[Localizable(false)] public class ProSearchResultViewModel : BindableBase, IDialogAware { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -25,15 +26,16 @@ public class ProSearchResultViewModel : BindableBase, IDialogAware private string _folderPath; private bool _isSearchFocused; - public string Title { get => _title; set => SetProperty(ref _title, value); } + public string Title { get => _title; + private set => SetProperty(ref _title, value); } public ObservableCollection ImageUrl { get; set; } - public string SearchTitle { get => _searchTitle; set => SetProperty(ref _searchTitle, value); } + private string SearchTitle { get => _searchTitle; set => SetProperty(ref _searchTitle, value); } public bool StopSearch { get => _stopSearch; set => SetProperty(ref _stopSearch, value); } - public List Fnames { get; set; } + private List Fnames { get; set; } public string SearchAgainTitle { get => _searchAgainTitle; set => SetProperty(ref _searchAgainTitle, value); } public string BusyContent { get => _busyContent; set => SetProperty(ref _busyContent, value); } public bool IsBusy { get => _isBusy; set => SetProperty(ref _isBusy, value); } - public DArt DArtObject { get => _dArtObject; set => SetProperty(ref _dArtObject, value); } + private DArt DArtObject { get => _dArtObject; set => SetProperty(ref _dArtObject, value); } public int Index { get => _index; set => SetProperty(ref _index, value); } public int TotalPosters { get => _totalPosters; set => SetProperty(ref _totalPosters, value); } @@ -218,7 +220,7 @@ private void PickMethod(object parameter) var currentPath = $@"{_folderPath}\{Fnames[_i]}"; var tempImage = new ImageToDownload { - LocalPath = $"{currentPath}\\{IconUtils.GetImageName()}.png", + LocalPath = $@"{currentPath}\{IconUtils.GetImageName()}.png", RemotePath = new Uri(link) }; Logger.Debug("Adding Image to Download List {@Image}", tempImage); @@ -266,7 +268,7 @@ protected virtual void CloseDialog(string parameter) RaiseRequestClose(new DialogResult(result)); } - public virtual void RaiseRequestClose(IDialogResult dialogResult) + protected virtual void RaiseRequestClose(IDialogResult dialogResult) { RequestClose?.Invoke(dialogResult); } diff --git a/FoliCon/ViewModels/SearchResultViewModel.cs b/FoliCon/ViewModels/SearchResultViewModel.cs index 64338fbd..810471f2 100644 --- a/FoliCon/ViewModels/SearchResultViewModel.cs +++ b/FoliCon/ViewModels/SearchResultViewModel.cs @@ -2,6 +2,7 @@ namespace FoliCon.ViewModels; +[Localizable(false)] public class SearchResultViewModel : BindableBase, IDialogAware { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -163,7 +164,7 @@ protected virtual void CloseDialog(string parameter, bool skipAll) RaiseRequestClose(new DialogResult(result, parameters)); } - public virtual void RaiseRequestClose(IDialogResult dialogResult) + protected virtual void RaiseRequestClose(IDialogResult dialogResult) { RequestClose?.Invoke(dialogResult); } diff --git a/FoliCon/ViewModels/posterIconConfigViewModel.cs b/FoliCon/ViewModels/posterIconConfigViewModel.cs index 34972cf1..47b90ec7 100644 --- a/FoliCon/ViewModels/posterIconConfigViewModel.cs +++ b/FoliCon/ViewModels/posterIconConfigViewModel.cs @@ -1,5 +1,6 @@ namespace FoliCon.ViewModels; +[Localizable(false)] public class PosterIconConfigViewModel : BindableBase, IDialogAware { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); @@ -10,7 +11,7 @@ public PosterIconConfigViewModel() { Logger.Debug("PosterIconConfigViewModel created"); Services.Tracker.Configure() - .Property(p => p.IconOverlay, defaultValue: "Liaher") + .Property(p => p.IconOverlay, defaultValue: Models.Enums.IconOverlay.Liaher.ToString()) .PersistOn(nameof(PropertyChanged)); Services.Tracker.Track(this); Logger.Info("Current IconOverlay is {IconOverlay}", IconOverlay); diff --git a/FoliCon/Views/HtmlBox.xaml.cs b/FoliCon/Views/HtmlBox.xaml.cs index 5a2bc783..32719285 100644 --- a/FoliCon/Views/HtmlBox.xaml.cs +++ b/FoliCon/Views/HtmlBox.xaml.cs @@ -5,12 +5,15 @@ namespace FoliCon.Views; /// /// Interaction logic for HtmlBox.xaml /// +[Localizable(false)] public partial class HtmlBox { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private const string VideoUnavailable = "Video not available!"; private readonly string _backgroundColor; - + private const string DarkGray = "#1C1C1C"; + private const string White = "#FFFFFF"; + public static readonly DependencyProperty HtmlTextProperty = DependencyProperty.Register( nameof(HtmlText), @@ -18,12 +21,12 @@ public static readonly DependencyProperty HtmlTextProperty typeof(HtmlBox), new PropertyMetadata(default(string), OnHtmlTextPropertyChanged)); - public bool IsVideoAvailable { get; private set; } + private bool IsVideoAvailable { get; set; } public HtmlBox() { InitializeComponent(); - _backgroundColor = ThemeManager.Current.ApplicationTheme == ApplicationTheme.Dark ? "#1C1C1C" : "#FFFFFF"; + _backgroundColor = ThemeManager.Current.ApplicationTheme == ApplicationTheme.Dark ? DarkGray : White; } public string HtmlText diff --git a/FoliCon/Views/ImageGalleryControl.xaml.cs b/FoliCon/Views/ImageGalleryControl.xaml.cs index 6caa697a..c434fbe1 100644 --- a/FoliCon/Views/ImageGalleryControl.xaml.cs +++ b/FoliCon/Views/ImageGalleryControl.xaml.cs @@ -2,6 +2,7 @@ namespace FoliCon.Views; +[Localizable(false)] public partial class ImageGalleryControl {