diff --git a/src/Central.WinForms/AppTileManagement.cs b/src/Central.WinForms/AppTileManagement.cs index 3ce9c3c1b..36ee073b6 100644 --- a/src/Central.WinForms/AppTileManagement.cs +++ b/src/Central.WinForms/AppTileManagement.cs @@ -132,7 +132,10 @@ public async void UpdateMyApps() /// Loads a cached version of the catalog from the disk. /// public void LoadCachedCatalog() - => SetCatalog(_catalogManager.GetCachedSafe()); + { + if (_catalogManager.TryGetCached() is {} catalog) + SetCatalog(catalog); + } /// /// Updates the catalog from the web. diff --git a/src/Commands.WinForms/FeedBranding.cs b/src/Commands.WinForms/FeedBranding.cs index 32f7b824d..680d4ca86 100644 --- a/src/Commands.WinForms/FeedBranding.cs +++ b/src/Commands.WinForms/FeedBranding.cs @@ -46,12 +46,12 @@ public FeedBranding(FeedUri? feedUri) AppId = feed?.GetEntryPoint(Command.NameRun)?.AppId; Icon = feed ?.Icons.GetIcon(ModelIcon.MimeTypeIco) - ?.To(GetIconPath) + ?.To(TryGetIconPath) ?.To(LoadIcon) ?? LoadDefaultIcon(); SplashScreen = feed ?.SplashScreens.GetIcon(ModelIcon.MimeTypePng) - ?.To(GetIconPath) + ?.To(TryGetIconPath) ?.To(LoadSplashScreen); } @@ -70,12 +70,12 @@ public FeedBranding(FeedUri? feedUri) #endregion } - private static string? GetIconPath(Model.Icon icon) + private static string? TryGetIconPath(Model.Icon icon) { try { - return IconStores.DesktopIntegration(Config.LoadSafe(), new SilentTaskHandler(), machineWide: false).GetCached(icon) - ?? IconStores.DesktopIntegration(Config.LoadSafe(), new SilentTaskHandler(), machineWide: true).GetCached(icon); + return IconStores.DesktopIntegration(Config.LoadSafe(), new SilentTaskHandler(), machineWide: false).TryGetCached(icon) + ?? IconStores.DesktopIntegration(Config.LoadSafe(), new SilentTaskHandler(), machineWide: true).TryGetCached(icon); } #region Error handling catch (Exception ex) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b06055861..a4d835e53 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -24,8 +24,8 @@ 1.0.0-pre - 2.18.5 - 2.25.9 + 2.18.6 + 2.25.10 diff --git a/src/OneGet/OneGetContext.cs b/src/OneGet/OneGetContext.cs index e0bca3648..429714be0 100644 --- a/src/OneGet/OneGetContext.cs +++ b/src/OneGet/OneGetContext.cs @@ -39,7 +39,7 @@ public void AddPackageSource(string uri) CatalogManager.DownloadCatalog(feedUri); if (CatalogManager.AddSource(feedUri)) - CatalogManager.GetOnlineSafe(); + CatalogManager.TryGetOnline(); else Log.Warn(string.Format(Resources.CatalogAlreadyRegistered, feedUri.ToStringRfc())); } @@ -126,17 +126,14 @@ private IEnumerable GetCatalogResults(string? query) if (string.IsNullOrEmpty(query)) { Log.Info("Returning entire catalog"); - return (CatalogManager.GetCached() ?? CatalogManager.GetOnlineSafe()).Feeds; + return CatalogManager.Get().Feeds; } Log.Info("Searching for short-name match in Catalog: " + query); - var feed = FindByShortName(query); - if (feed == null) - { - Log.Info("Searching for partial match in Catalog: " + query); - return CatalogManager.GetCachedSafe().Search(query); - } - else return [feed]; + if (FindByShortName(query) is {} feed) return [feed]; + + Log.Info("Searching for partial match in Catalog: " + query); + return CatalogManager.Get().Search(query); } public void FindPackageBy(string identifier)