Skip to content

Commit

Permalink
fix download processes
Browse files Browse the repository at this point in the history
  • Loading branch information
msartore committed Nov 3, 2023
1 parent 6d61906 commit 3b61ab0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions ATA-GUI/ATA-GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
<ApplicationIcon>ATALogoGUI.ico</ApplicationIcon>

<!-- Versioning -->
<Version>3.0.1.0</Version>
<FileVersion>3.0.1.0</FileVersion>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>3.0.2.0</Version>
<FileVersion>3.0.2.0</FileVersion>
<AssemblyVersion>3.0.2.0</AssemblyVersion>
<Copyright>© 2021-2023 Massimiliano Sartore</Copyright>

<!-- Publish settings -->
Expand Down Expand Up @@ -40,6 +39,7 @@
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="ATALogoGUI.ico">
Expand Down
2 changes: 1 addition & 1 deletion ATA-GUI/Classes/ATA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace ATA_GUI.Classes
{
internal class ATA
{
public static readonly string CURRENTVERSION = "v3.0.1";
public static readonly string CURRENTVERSION = "v3.0.2";
public static readonly string IPFileName = "IPList.txt";

public ATA()
Expand Down
13 changes: 9 additions & 4 deletions ATA-GUI/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -182,7 +183,7 @@ private async Task updateCheckAsync()
{
if (MessageBox.Show("New version found: " + latestRelease + "\nCurrent Version: " + ATA.CURRENTVERSION + "\n\nDo you want to update it?", "Update found!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
_ = Process.Start((string)jsonReal[0]["html_url"]);
ConsoleProcess.openLink((string)jsonReal[0]["html_url"]);
jsonReal[0]["assets"][0].TryGetValue("browser_download_url", out JToken urlDownload);
UpdateForm update = new(urlDownload.ToString());
_ = update.ShowDialog();
Expand Down Expand Up @@ -554,7 +555,7 @@ public void ToolTipGenerator(Control button, string title, string message)
private void MainForm_Load(object sender, EventArgs e)
{
radioButtonBoot.Checked = true;

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
ToolTipGenerator(buttonConnectToIP, "Connect device", "Connect to your device with this IP");
ToolTipGenerator(buttonDisconnectIP, "Disconnect device", "Disconnect from your device with this IP");
ToolTipGenerator(buttonMobileScreenShare, "Share Device Screen", "Your device screen will be shared on your PC");
Expand Down Expand Up @@ -1269,6 +1270,10 @@ private async void backgroundWorkerAdbDownloader_DoWork(object sender, System.Co
}
LogWriteLine("sdk platform tool downloaded!");
LogWriteLine("unzipping sdk platform tool...");
if (Directory.Exists("platform-tools"))
{
Directory.Delete("platform-tools", true);
}
using (ZipFile zip = ZipFile.Read("sdkplatformtool.zip"))
{
zip.ExtractAll(Path.GetDirectoryName(Application.ExecutablePath));
Expand All @@ -1294,10 +1299,10 @@ private async void backgroundWorkerAdbDownloader_DoWork(object sender, System.Co

LogWriteLine("ATA ready!");
}
catch
catch (Exception ex)
{
LogWriteLine("[ERROR] An error occurred while attempting to download the SDK Platform Tools");
MessageShowBox("An error occurred while attempting to download the SDK Platform Tools", 0);
MessageShowBox("An error occurred while attempting to download the SDK Platform Tools\nError message:" + ex, 0);
disableSystem(true);
}
}
Expand Down
3 changes: 1 addition & 2 deletions ATA-GUI/Forms/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using ATA_GUI.Classes;
Expand Down Expand Up @@ -41,7 +40,7 @@ private async void buttonCheckLastVersion_ClickAsync(object sender, EventArgs e)
{
if (MessageBox.Show("New version found: " + latestRelease + "\nCurrent Version: " + CURRENTVERSION + "\n\nDo you want to update it?", "Update found!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
_ = Process.Start((string)jsonReal[0]["html_url"]);
ConsoleProcess.openLink((string)jsonReal[0]["html_url"]);
jsonReal[0]["assets"][0].TryGetValue("browser_download_url", out JToken urlDownload);
UpdateForm update = new(urlDownload.ToString());
_ = update.ShowDialog();
Expand Down
4 changes: 4 additions & 0 deletions ATA-GUI/Utils/ConsoleProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public static string systemProcess(string command, string exe, string arguments)
cmd.Close();
return result;
}
public static void openLink(string link)
{
_ = Process.Start(new ProcessStartInfo(link) { UseShellExecute = true });
}

public static string systemCommand(string command)
{
Expand Down

0 comments on commit 3b61ab0

Please sign in to comment.