Skip to content

Commit

Permalink
Merge pull request #91 from lilyremigia/master
Browse files Browse the repository at this point in the history
Fix various issue and add future nagging to switch
  • Loading branch information
brliron authored Mar 12, 2024
2 parents 3bd9d0a + 8f5b81c commit 52822fc
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 11 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.

58 changes: 55 additions & 3 deletions Universal THCRAP Launcher/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
using System.Globalization;
using System.IO;
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 @@ -75,6 +77,7 @@ public MainForm()
private void Form1_Load(object sender, EventArgs e)
{
InitData();
CheckIfObsolote();
DownloadCurrentLanguage();

GetPatchList();
Expand All @@ -84,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 @@ -262,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 @@ -376,14 +386,14 @@ private void filterByType_button_Click(object sender, EventArgs e)
private void exitTS_Click(object sender, EventArgs e) => Application.Exit();

private void bugReportTS_Click(object sender, EventArgs e) => Process.Start(
"https://github.com/Tudi20/Universal-THCRAP-Launcher/issues/" +
"https://github.com/thpatch/Universal-THCRAP-Launcher/issues/" +
"new?assignees=&labels=bug&template=bug_report.md&title=%5BBUG%5D");

private void otherTS_Click(object sender, EventArgs e) =>
Process.Start("https://github.com/Tudi20/Universal-THCRAP-Launcher/issues/new");
Process.Start("https://github.com/thpatch/Universal-THCRAP-Launcher/issues/new");

private void gitHubPageTS_Click(object sender, EventArgs e) =>
Process.Start("https://github.com/Tudi20/Universal-THCRAP-Launcher");
Process.Start("https://github.com/thpatch/Universal-THCRAP-Launcher");

private void DonateToolStripMenuItem_Click(object sender, EventArgs e) => Process.Start("https://ko-fi.com/tudi20");

Expand Down Expand Up @@ -413,6 +423,20 @@ private void openConfigureTS_Click(object sender, EventArgs e)

private void openSelectedPatchConfigurationTS_Click(object sender, EventArgs e)
{
if (patchListBox.SelectedIndex == -1)
{
SystemSounds.Hand.Play();
return;
}

string v;
v = (I18N.LangResource.mainForm.vanilla.ToString() is null) ? @"VANILLA" : I18N.LangResource.mainForm.vanilla.ToString();
if (patchListBox.SelectedItem.ToString().Contains(v))
{
SystemSounds.Hand.Play();
return;
}

string path = Directory.GetCurrentDirectory() + @"\" + CONFIG_FOLDER +
patchListBox.SelectedItem.ToString().Replace(" ★", "");
if (Configuration1.HidePatchExtension)
Expand Down Expand Up @@ -709,6 +733,34 @@ 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");



try
{
string response = client.GetStringAsync(url).Result;
dynamic json = JsonConvert.DeserializeObject(response);

if (json.archived == "true")
{
TryNewLauncherLabel.Visible = true;
TryNewLauncherLabel.Enabled = true;
}
}
catch (Exception e)
{
_log.WriteLine($"Couldn't check if the launcher is obsolote:\n\t{e}");
}


}

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

0 comments on commit 52822fc

Please sign in to comment.