Skip to content

Commit 450f8f9

Browse files
committed
fix github url in UpdateChecker.cs
1 parent 61362af commit 450f8f9

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/Hypnonema.Server/BaseServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private async Task OnFirstTick()
123123
Events.GetMaxActiveScaleforms,
124124
this.OnGetMaxActiveScaleforms);
125125

126-
await UpdateChecker.CheckForNewerVersion();
126+
await UpdateChecker.CheckForUpdate();
127127
await Delay(0);
128128
}
129129

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
namespace Hypnonema.Server.Utils
1+
using System;
2+
using System.Linq;
3+
using System.Net;
4+
using System.Reflection;
5+
using System.Threading.Tasks;
6+
using CitizenFX.Core;
7+
using Octokit;
8+
9+
namespace Hypnonema.Server.Utils
210
{
3-
using System;
4-
using System.Linq;
5-
using System.Net;
6-
using System.Reflection;
7-
using System.Threading.Tasks;
8-
9-
using CitizenFX.Core;
10-
11-
using Octokit;
12-
13-
public class UpdateChecker
11+
public sealed class UpdateChecker
1412
{
1513
private const string RepositoryName = "fivem-hypnonema";
1614

17-
private const string RepositoryOwner = "thiago-dev";
15+
private const string RepositoryOwner = "charming-byte";
16+
17+
private static readonly GitHubClient Client = new GitHubClient( new ProductHeaderValue("hypnonema"));
1818

1919
private static Version LocalVersion => new Version(GetAssemblyFileVersion());
2020

21-
public static async Task CheckForNewerVersion()
21+
public static async Task CheckForUpdate()
2222
{
2323
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
24-
var client = new GitHubClient(new ProductHeaderValue("hypnonema"));
2524

2625
try
2726
{
28-
var releases = await client.Repository.Release.GetAll(RepositoryOwner, RepositoryName);
29-
if (releases == null) return;
27+
var latestRelease = await Client.Repository.Release.GetLatest(RepositoryOwner, RepositoryName);
3028

31-
var latestVersion = new Version(releases[0].TagName);
29+
var latestVersion = new Version(latestRelease.TagName);
3230

3331
var versionComparison = LocalVersion.CompareTo(latestVersion);
32+
3433
if (versionComparison < 0)
34+
{
35+
await BaseScript.Delay(1);
3536

36-
// Newer Version found.
37-
Debug.WriteLine(
38-
$"^5There is a newer version \"{latestVersion}\" of Hypnonema available for download!");
37+
Debug.WriteLine($"^3An update is available for hypnonema (current version: {LocalVersion})\n {latestRelease.HtmlUrl} ^7");
38+
}
3939
}
40-
catch (Exception e)
40+
catch (Exception)
4141
{
42-
Console.WriteLine(e);
42+
// Do nothing with the exception
4343
}
4444
}
4545

4646
private static string GetAssemblyFileVersion()
4747
{
48-
var attribute = (AssemblyFileVersionAttribute) Assembly.GetExecutingAssembly()
49-
.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Single();
48+
var attribute = (AssemblyFileVersionAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Single();
49+
5050
return attribute.Version;
5151
}
5252
}
53-
}
53+
}

0 commit comments

Comments
 (0)