Skip to content

Commit

Permalink
Updated Zero Install .NET
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Jul 25, 2024
1 parent e127384 commit dc9e71b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
5 changes: 4 additions & 1 deletion src/Central.WinForms/AppTileManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ public async void UpdateMyApps()
/// Loads a cached version of the catalog from the disk.
/// </summary>
public void LoadCachedCatalog()
=> SetCatalog(_catalogManager.GetCachedSafe());
{
if (_catalogManager.TryGetCached() is {} catalog)
SetCatalog(catalog);
}

/// <summary>
/// Updates the catalog from the web.
Expand Down
10 changes: 5 additions & 5 deletions src/Commands.WinForms/FeedBranding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<Version>1.0.0-pre</Version>

<!-- Dependency versions -->
<NanoByteCommonVersion>2.18.5</NanoByteCommonVersion>
<ZeroInstallVersion>2.25.9</ZeroInstallVersion>
<NanoByteCommonVersion>2.18.6</NanoByteCommonVersion>
<ZeroInstallVersion>2.25.10</ZeroInstallVersion>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)App.config" />
Expand Down
15 changes: 6 additions & 9 deletions src/OneGet/OneGetContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down Expand Up @@ -126,17 +126,14 @@ private IEnumerable<Feed> 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)
Expand Down

0 comments on commit dc9e71b

Please sign in to comment.