initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: UpdateChecker
|
||||
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
||||
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
||||
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#nullable disable
|
||||
public static class UpdateChecker
|
||||
{
|
||||
private const string ApiUrl = "https://codeberg.org/api/v1/repos/sillycs/notratonupdates/releases/latest";
|
||||
|
||||
public static async Task<bool> IsUpdateAvailableAsync(string currentVersion)
|
||||
{
|
||||
HttpClient httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("RatonUpdater/1.0");
|
||||
string v = Regex.Match(await httpClient.GetStringAsync("https://codeberg.org/api/v1/repos/sillycs/notratonupdates/releases/latest"), "\"tag_name\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value;
|
||||
return !string.IsNullOrEmpty(v) && UpdateChecker.Normalize(currentVersion) != UpdateChecker.Normalize(v);
|
||||
}
|
||||
|
||||
public static async Task<string> GetLatestVersionAsync()
|
||||
{
|
||||
HttpClient httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("RatonUpdater/1.0");
|
||||
return Regex.Match(await httpClient.GetStringAsync("https://codeberg.org/api/v1/repos/sillycs/notratonupdates/releases/latest"), "\"tag_name\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value;
|
||||
}
|
||||
|
||||
private static string Normalize(string v) => v.Trim().TrimStart('v', 'V');
|
||||
}
|
||||
Reference in New Issue
Block a user