Skip to content

Commit

Permalink
Fixed bug with version checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
Somfic committed Oct 1, 2019
1 parent ae9a595 commit 632c461
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions EliteAPI/EliteAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyVersion>2.1.13.836</AssemblyVersion>
<FileVersion>2.1.13.836</FileVersion>
<AssemblyVersion>2.1.16.839</AssemblyVersion>
<FileVersion>2.1.16.839</FileVersion>
<PackageProjectUrl>https://github.com/EliteAPI/EliteAPI</PackageProjectUrl>
<RepositoryUrl>https://github.com/EliteAPI/EliteAPI</RepositoryUrl>
<PackageIconUrl>https://i.imgur.com/keDXwjY.png</PackageIconUrl>
Expand All @@ -14,7 +14,7 @@
VoiceAttack, VoiceMacro, Discord, C#, VB</Description>
<Copyright>Somfic 2019</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>2.1.12.835</Version>
<Version>2.1.15.838</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
16 changes: 11 additions & 5 deletions EliteAPI/EliteDangerousAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static DirectoryInfo StandardDirectory
/// <summary>
/// The version of EliteAPI.
/// </summary>
public string Version => "2.0.2.10";
public string Version => "2.1.15.838";

/// <summary>
/// Whether the API is currently running.
Expand Down Expand Up @@ -209,14 +209,20 @@ public bool CheckForUpdate()
try
{
WebClient versionChecker = new WebClient();
string latestVersionString = versionChecker.DownloadString("https://raw.githubusercontent.com/EliteAPI/EliteAPI/master/EliteAPI%202/versioncontrol.version").Trim();
string latestVersionString = versionChecker.DownloadString("https://raw.githubusercontent.com/EliteAPI/EliteAPI/master/EliteAPI/versioncontrol.version").Trim();

Logger.Debug($"Latest version: {latestVersionString} (curr. {Version}).");

int latestVersion = int.Parse(latestVersionString.Replace(".", ""));
int thisVersoin = int.Parse(Version.Replace(".", ""));
string[] latestVersion = latestVersionString.Split('.');
string[] thisVersion = Version.Split('.');

if (thisVersoin < latestVersion) { Logger.Log($"A new update ({latestVersionString}) is available. Visit github.com/EliteAPI/EliteAPI to download the latest version."); return true; } else { Logger.Debug("EliteAPI is up-to-date with the latest version."); }
bool hasBiggerVersion = false;
for (int i = 0; i < latestVersion.Length; i++)
{
if(int.Parse(latestVersion[i]) > int.Parse(thisVersion[i])) { hasBiggerVersion = true; }
}

if (hasBiggerVersion) { Logger.Log($"A new update ({latestVersionString}) is available. Visit github.com/EliteAPI/EliteAPI to download the latest version."); return true; } else { Logger.Debug("EliteAPI is up-to-date with the latest version."); }
}
catch (Exception ex) { Logger.Debug("Could not check for updates.", ex); }

Expand Down
2 changes: 1 addition & 1 deletion EliteAPI/ThirdParty/EliteVA/EliteVA.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "EliteVA"
#define MyAppVersion "2.1.12.835"
#define MyAppVersion "2.1.15.838"
#define MyAppPublisher "Somfic"
#define MyAppURL "https://github.com/EliteAPI/EliteAPI"

Expand Down
2 changes: 1 addition & 1 deletion EliteAPI/versioncontrol.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.12.835
2.1.15.838
2 changes: 1 addition & 1 deletion Example/Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<AssemblyVersion>1.0.23.2056</AssemblyVersion>
<AssemblyVersion>1.0.26.2059</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
6 changes: 3 additions & 3 deletions Example/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.23.2056")]
[assembly: AssemblyFileVersion("1.0.22.2056")]
[assembly: AssemblyVersion("1.0.26.2059")]
[assembly: AssemblyFileVersion("1.0.25.2059")]

[assembly: AssemblyInformationalVersion("1.0.25")]
[assembly: AssemblyInformationalVersion("1.0.28")]

0 comments on commit 632c461

Please sign in to comment.