Skip to content

Commit

Permalink
Check for updates on launch
Browse files Browse the repository at this point in the history
  • Loading branch information
koyuawsmbrtn committed Jan 12, 2024
1 parent 3a43617 commit d471e8d
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions PlaySync/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class Main : Form
bool pluggedin = false;
bool syncing = false;
bool cansync = false;
string version = "0";
string version = "1";
string oldtext = "";
string deviceinfo = "";
string[] games;
Expand All @@ -38,7 +38,7 @@ public static bool isDebug
#if DEBUG
return true;
#else
return false;
return false;
#endif
}
}
Expand Down Expand Up @@ -74,14 +74,36 @@ public Main()
toolStripMenuItem2.Checked = false;
}
string[] args = Environment.GetCommandLineArgs();
bool autostart = false;
foreach (string arg in args)
{
if (arg == "--autostart")
{
autostart = true;
this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
}
}
if (!autostart)
{
try
{
string pubv = new WebClient().DownloadString("https://updates.koyu.space/playsync/latest");
if (pubv.Split('\n')[0] != version)
{
DialogResult result = MessageBox.Show("New update available. Download now?", "New update available", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
launchUrl("https://updates.koyu.space/playsync/playsync.zip");
}
}
else
{
MessageBox.Show("PlaySync is up to date!", "Up to date", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch { }
}
}

private void readGames(string readfolder)
Expand Down

0 comments on commit d471e8d

Please sign in to comment.