Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Update bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
barisyild committed Sep 13, 2018
1 parent 0915fe2 commit 26ac04f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
7 changes: 5 additions & 2 deletions OnPSApp/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace OnPS
{
public partial class Loader : Form
{
private Updater updater;
public int connectAttempt = 0;
public Loader()
{
Expand All @@ -22,13 +23,13 @@ public Loader()
Environment.Exit(-1);
return;
}
Updater updater = new Updater();
updater = new Updater();
updater.UpdateAvailable += onUpdateAvailable;
}

public void onUpdateAvailable(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("OnPS new version is available now.\nWould you like to update it?", "Update Available",MessageBoxButtons.OKCancel);
DialogResult result = MessageBox.Show("OnPS new version is available now.\nWould you like to update it?", "Update Available",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
if(result == DialogResult.OK)
{
Process.Start("https://www.onpsapp.com/");
Expand Down Expand Up @@ -56,6 +57,8 @@ public bool InitializeLoader()

private void Loader_Shown(object sender, EventArgs e)
{
this.Visible = false;
updater.run();
String AccessToken = null;
String PSNRefreshToken = IniModel.GetPSNRefreshToken();
if (PSNRefreshToken == null)
Expand Down
16 changes: 12 additions & 4 deletions OnPSApp/Other/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,31 @@ namespace OnPS.Other
class Updater
{
public EventHandler UpdateAvailable;
public const String URL = "http://onpsapp.com/update.json";
public const String URL = "https://www.onpsapp.com/update.json";
public Updater()
{

}

public void run()
{
String data;
try
{
data = Network.HTTP_GET(URL, "", "");
}
catch(Exception e)
catch (Exception e)
{
//Update Halted!
return;
}
JObject updateData = JObject.Parse(data);
if(updateData["version"].ToString() != Program.VERSION)
if (updateData["version"].ToString() != Program.VERSION)
{
UpdateAvailable(this, new EventArgs());
if (UpdateAvailable != null)
{
UpdateAvailable(this, EventArgs.Empty);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion OnPSApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace OnPS
static class Program
{
public static String SavePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/OnPS/";
public const String VERSION = "1.0.0.0";
public const String VERSION = "1.0.0.1";
public static NotifyIcon notifyIcon;
public static bool steamAvailable = false;
private static Mutex mutex;
Expand Down

0 comments on commit 26ac04f

Please sign in to comment.