Skip to content

Commit

Permalink
Fixed: Broken Release Metadata Fetch due to Lib Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Aug 4, 2022
1 parent c6b197c commit 6ef061f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
Title="{DynamicResource TitleDownloadMods}">
<Grid x:Name="Contents" DataContext="{Binding Path=ViewModel, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}">

<Grid.Resources>
<download:CheckForUpdatesAndDependenciesCommand x:Key="CheckForUpdatesAndDependenciesCommand"/>
</Grid.Resources>

<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<!-- Current Item Overlay -->


<!-- Search -->
<Grid Grid.Row="0" HorizontalAlignment="Stretch" Margin="{DynamicResource CommonItemVerticalMarginSmall}">
<Grid.ColumnDefinitions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class GameBananaPackageProvider : IDownloadablePackageProvider
/// </summary>
public int GameId { get; private set; }

private string _dummyFolderForReleaseVerification = Path.GetTempPath();

/// <summary/>
public GameBananaPackageProvider(int gameId)
{
Expand Down Expand Up @@ -118,7 +120,7 @@ private static bool CheckIfHasMultipleReloadedFiles(Dictionary<string, GameBanan
return false;
}

private static async Task<bool> TryAddResultsFromReleaseMetadataAsync(GameBananaMod gbApiItem, ConcurrentBag<IDownloadablePackage> results)
private async Task<bool> TryAddResultsFromReleaseMetadataAsync(GameBananaMod gbApiItem, ConcurrentBag<IDownloadablePackage> results)
{
const string metadataExtension = ".json";
const int maxFileSize = 512 * 1024; // 512KB. To prevent abuse of large JSON files.
Expand All @@ -140,7 +142,7 @@ private static async Task<bool> TryAddResultsFromReleaseMetadataAsync(GameBanana
return numAddedItems > 0;
}

private static async Task<int> TryAddResultFromReleaseMetadataFile(ConcurrentBag<IDownloadablePackage> results, WebClient client, GameBananaModFile file, GameBananaMod item)
private async Task<int> TryAddResultFromReleaseMetadataFile(ConcurrentBag<IDownloadablePackage> results, WebClient client, GameBananaModFile file, GameBananaMod item)
{
var metadata = await client.DownloadDataTaskAsync(new Uri(file.DownloadUrl!));
try
Expand All @@ -152,7 +154,11 @@ private static async Task<int> TryAddResultFromReleaseMetadataFile(ConcurrentBag

// Get the highest version of release.
var highestVersion = releaseMetadata.Releases.OrderByDescending(x => new NuGetVersion(x.Version)).First();
var newestRelease = releaseMetadata.GetRelease(highestVersion.Version, new ReleaseMetadataVerificationInfo());
var newestRelease = releaseMetadata.GetRelease(highestVersion.Version, new ReleaseMetadataVerificationInfo()
{
FolderPath = _dummyFolderForReleaseVerification
});

if (newestRelease == null)
return 0;

Expand Down

0 comments on commit 6ef061f

Please sign in to comment.