Skip to content

Commit f18a977

Browse files
authored
Fix version check (#59)
1 parent 39ef6b9 commit f18a977

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

nanoFirmwareFlasher/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,16 @@ await parsedArguments
8686
return (int)_exitCode;
8787
}
8888

89-
private static void CheckVersion(Version currentVversion)
89+
private static void CheckVersion()
9090
{
9191
Version latestVersion;
92+
Version currentVersion = Version.Parse(_informationalVersionAttribute.InformationalVersion.Split('+')[0]);
9293

9394
using (var client = new HttpClient())
9495
{
9596
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
9697

97-
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("nanoff", currentVversion.ToString()));
98+
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("nanoff", currentVersion.ToString()));
9899

99100
HttpResponseMessage response = client.GetAsync("https://api.github.com/repos/nanoframework/nanoFirmwareFlasher/releases/latest").Result;
100101

@@ -104,7 +105,7 @@ private static void CheckVersion(Version currentVversion)
104105
latestVersion = Version.Parse(tagName.Substring(1));
105106
}
106107

107-
if(latestVersion > currentVversion)
108+
if(latestVersion > currentVersion)
108109
{
109110
Console.ForegroundColor = ConsoleColor.DarkYellow;
110111
Console.WriteLine("** There is a new version available, update is recommended **");
@@ -166,7 +167,8 @@ static async Task RunOptionsAndReturnExitCodeAsync(Options o)
166167
Console.WriteLine(_copyrightInfo);
167168
Console.WriteLine();
168169

169-
CheckVersion(Assembly.GetExecutingAssembly().GetName().Version);
170+
// perform version check
171+
CheckVersion();
170172
Console.WriteLine();
171173

172174
Console.ForegroundColor = ConsoleColor.White;

0 commit comments

Comments
 (0)