Skip to content

Commit

Permalink
Restore default version support for SpaceDock
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Dec 6, 2024
1 parent c70b5cd commit 3b29b0d
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions Netkan/Sources/Spacedock/SpacedockMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,13 @@ internal class SpacedockMod
[JsonProperty] public Uri? background;

public SDVersion Latest()
{
// The version we want is specified by `default_version_id`, it's not just
// the latest. See GH #214. Thanks to @Starstrider42 for spotting this.

var latest =
from release in versions
where release.id == default_version_id
select release
;

// There should only ever be one.
return latest.First();
}
=> All().First();

public IEnumerable<SDVersion> All()
=> versions ?? Enumerable.Empty<SDVersion>();
// The version we want is specified by `default_version_id`, it's not just
// the latest. See GH #214. Thanks to @Starstrider42 for spotting this.
=> versions?.OrderByDescending(v => v.id == default_version_id)
?? Enumerable.Empty<SDVersion>();

/// <summary>
/// Returns the path to the mod's home on SpaceDock
Expand Down

0 comments on commit 3b29b0d

Please sign in to comment.