Skip to content

Commit

Permalink
Auto skip logo when unavailable
Browse files Browse the repository at this point in the history
Fixed #120
  • Loading branch information
svrooij committed Nov 13, 2024
1 parent 491ea9f commit 4aa7bcc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Svrooij.WinTuner.CmdLets/Commands/DeployWtWin32App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected override async Task ProcessAuthenticatedAsync(IAuthenticationProvider
logger?.LogDebug("Loading package info from folder {PackageFolder}", PackageFolder);
var packageInfo = await metadataManager!.LoadPackageInfoFromFolderAsync(PackageFolder, cancellationToken);
App = metadataManager.ConvertPackageInfoToWin32App(packageInfo);
LogoPath = Path.Combine(PackageFolder, "..", "logo.png");
LogoPath = Path.GetFullPath(Path.Combine(PackageFolder, "..", "logo.png"));
IntuneWinFile = metadataManager.GetIntuneWinFileName(PackageFolder, packageInfo);
}
}
Expand Down
15 changes: 11 additions & 4 deletions src/WingetIntune/Intune/IntuneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,19 @@ private async Task AssignAppAsync(GraphServiceClient graphServiceClient, string
}
}

internal Task DownloadLogoAsync(string packageFolder, string packageId, CancellationToken cancellationToken)
internal async Task DownloadLogoAsync(string packageFolder, string packageId, CancellationToken cancellationToken)
{
var logoPath = Path.GetFullPath(Path.Combine(packageFolder, "..", "logo.png"));
var logoUri = $"https://api.winstall.app/icons/{packageId}.png";//new Uri($"https://winget.azureedge.net/cache/icons/48x48/{packageId}.png");
LogDownloadLogo(logoUri);
return fileManager.DownloadFileAsync(logoUri, logoPath, throwOnFailure: false, overrideFile: false, cancellationToken: cancellationToken);
try
{
var logoUri = $"https://api.winstall.app/icons/{packageId}.png";//new Uri($"https://winget.azureedge.net/cache/icons/48x48/{packageId}.png");
LogDownloadLogo(logoUri);
await fileManager.DownloadFileAsync(logoUri, logoPath, throwOnFailure: false, overrideFile: false, cancellationToken: cancellationToken);
} catch (Exception e)

Check failure on line 456 in src/WingetIntune/Intune/IntuneManager.cs

View workflow job for this annotation

GitHub Actions / 🛠️ Build and Test C#

Fix whitespace formatting. Replace 1 characters with '\r\n\s\s\s\s\s\s\s\s'. [/home/runner/work/WingetIntune/WingetIntune/src/WingetIntune/WingetIntune.csproj]
{
logger.LogWarning(e, "Error downloading logo for {PackageId}, place your own logo here: {LogoPath}", packageId, logoPath);
}

Check failure on line 460 in src/WingetIntune/Intune/IntuneManager.cs

View workflow job for this annotation

GitHub Actions / 🛠️ Build and Test C#

Fix whitespace formatting. Replace 14 characters with '\r\n\s\s\s\s'. [/home/runner/work/WingetIntune/WingetIntune/src/WingetIntune/WingetIntune.csproj]
}

internal async Task<string> DownloadInstallerAsync(string tempPackageFolder, PackageInfo packageInfo, CancellationToken cancellationToken)
Expand Down

0 comments on commit 4aa7bcc

Please sign in to comment.