Skip to content

Commit

Permalink
If repository is archived, show nagware to switch
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyremigia committed Mar 12, 2024
1 parent f400ab3 commit 842f406
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 8 deletions.
38 changes: 30 additions & 8 deletions Universal THCRAP Launcher/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Universal THCRAP Launcher/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Media;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -76,6 +77,7 @@ public MainForm()
private void Form1_Load(object sender, EventArgs e)
{
InitData();
CheckIfObsolote();
DownloadCurrentLanguage();

GetPatchList();
Expand All @@ -85,6 +87,7 @@ private void Form1_Load(object sender, EventArgs e)

LogConfiguration();
}

private void MainForm_Activated(object sender, EventArgs e) => FillJumpList();
private void MainForm_KeyUp(object sender, KeyEventArgs e)
{
Expand Down Expand Up @@ -263,6 +266,12 @@ private void NotifyIcon1_MouseClick(object sender, MouseEventArgs e)
}
}

private void TryNewLauncherLabel_Click(object sender, EventArgs e)
{
TryNewLauncherLabel.Visible = false;
TryNewLauncherLabel.Enabled = false;
}

#region Sorting/Filtering Button Click Methods

private void sortAZButton1_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -724,6 +733,23 @@ public void UpdateConfigFile()

#region Methods Related to GUI

private void CheckIfObsolote()
{
var url = (@"https://api.github.com/repos/thpatch/Universal-THCRAP-Launcher");

HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("User-Agent", "request");
string response = client.GetStringAsync(url).Result;

dynamic json = JsonConvert.DeserializeObject(response);

if (json.archived == "true")
{
TryNewLauncherLabel.Visible = true;
TryNewLauncherLabel.Enabled = true;
}
}

public void PopulateGames()
{
gameListBox.Items.Clear();
Expand Down

0 comments on commit 842f406

Please # to comment.