Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
IsDefault will be broken if new version, fixed. Kinda.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Jul 28, 2017
1 parent 0e10c07 commit b14878e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 1 addition & 8 deletions P3D-Legacy Launcher/Data/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ public static async Task<List<Version>> GetAvailableVersionsAsync(ProfileType pr
public ProfileFolder Folder => new ProfileFolder(Name, ProfileType);
public List<ModificationInfo> ModificationInfos => Folder.ModFolder.GetModificationFolders().Select(mod => mod.ModificationFile.ModificationInfo).ToList();

public bool IsDefault
{
get
{
var latestVersion = AsyncExtensions.RunSync(async () => await GetAvailableVersionsAsync()).FirstOrDefault();
return Name == "Latest" && latestVersion != null ? latestVersion == Version : Version == NoVersion;
}
}
public bool IsDefault => Name == "Latest";
public bool IsSupportingGameJolt => ProfileType.IsSupportingGameJolt(Version);

public Profile(ProfileType profileType, string name, Version version, string launchArgs = "")
Expand Down
12 changes: 12 additions & 0 deletions P3D-Legacy Launcher/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,18 @@ private async Task CheckProfileForUpdateAsync(bool onStartup = false) // -- onSt
if (gameReleases.Any() && (!onStartup || CurrentProfile.IsDefault))
{
var latestRelease = gameReleases.First();

if (CurrentProfile.IsDefault)
{
if(CurrentProfile.Version < latestRelease.Version)
{
Log($"Found a new Profile '{CurrentProfile.Name}' version [{latestRelease.Version}]!");
UpdateCurrentProfile(latestRelease);
return;
}
}


if (CurrentProfile.Version < latestRelease.Version || CurrentProfile.VersionExe < latestRelease.Version)
{
Log($"Found a new Profile '{CurrentProfile.Name}' version [{latestRelease.Version}]!");
Expand Down

0 comments on commit b14878e

Please sign in to comment.