Skip to content

Commit

Permalink
fixed access denied explorer link problem
Browse files Browse the repository at this point in the history
  • Loading branch information
kgsensei committed Aug 28, 2024
1 parent 80b7fdd commit c525f9a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
19 changes: 18 additions & 1 deletion src/Connections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void ErrorReport(string? errorMessage = "Unknown", string? stackTr
{
RequestUri = BuildEnvironment.ErrorReportingEndpoint,
Method = HttpMethod.Post,
Content = new StringContent("{\"a\":\"" + errorMessage + "\",\"b\":\"None\",\"c\":0,\"d\":0,\"e\":\"" + safeStackTrace + "\",\"f\":\"NitroType Cheat\"}", Encoding.UTF8, "application/json"),
Content = new StringContent("{\"a\":\"" + errorMessage + "\",\"b\":\"None\",\"c\":0,\"d\":0,\"e\":\"" + safeStackTrace + "\",\"f\":\"NitroType Cheat v" + Updates.VersionCode + "\"}", Encoding.UTF8, "application/json"),
};

try
Expand All @@ -46,5 +46,22 @@ public static void ErrorReport(string? errorMessage = "Unknown", string? stackTr
catch (Exception) { }
}
}

public static void OpenLink(string url)
{
try
{
System.Diagnostics.Process.Start("explorer.exe", url);
}
catch (Exception)
{
MessageBox.Show(
"Error: Couldn't open link, lacking permissions.\n\n" + url,
"Internal Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
}
}
}
2 changes: 1 addition & 1 deletion src/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private void UI_Update_Godmode(object? sender, EventArgs e)
private void UI_Click_Discord(object sender, EventArgs e)
{
Logger.Log("Discord Button Clicked");
System.Diagnostics.Process.Start("explorer.exe", BuildEnvironment.DiscordLink);
Connections.OpenLink(BuildEnvironment.DiscordLink);
}

private async void UI_Click_Start(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static async void ShouldUpdate()
if (WantsUpdate == DialogResult.Yes)
{
Logger.Log("Opening Update Link");
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/kgsensei/NitroTypeHack2/releases/latest");
Connections.OpenLink("https://github.com/kgsensei/NitroTypeHack2/releases/latest");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
class Updates
{
public static string VersionCode = "4.6.1";
public static string VersionCode = "4.6.2";

public static async Task<Boolean> ShouldUpdate()
{
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.6.1
4.6.2

0 comments on commit c525f9a

Please sign in to comment.