From 26ac04fd9ad38f69dd55a3d0f40f9d583994354f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20=C3=87a=C4=9Fr=C4=B1=20Y=C4=B1ld=C4=B1r?= =?UTF-8?q?=C4=B1m?= Date: Thu, 13 Sep 2018 06:30:12 +0300 Subject: [PATCH] Update bug fixed. --- OnPSApp/Loader.cs | 7 +++++-- OnPSApp/Other/Updater.cs | 16 ++++++++++++---- OnPSApp/Program.cs | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/OnPSApp/Loader.cs b/OnPSApp/Loader.cs index 24d9ace..88b6c2e 100644 --- a/OnPSApp/Loader.cs +++ b/OnPSApp/Loader.cs @@ -13,6 +13,7 @@ namespace OnPS { public partial class Loader : Form { + private Updater updater; public int connectAttempt = 0; public Loader() { @@ -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/"); @@ -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) diff --git a/OnPSApp/Other/Updater.cs b/OnPSApp/Other/Updater.cs index 2baf616..45e33d7 100644 --- a/OnPSApp/Other/Updater.cs +++ b/OnPSApp/Other/Updater.cs @@ -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); + } } } diff --git a/OnPSApp/Program.cs b/OnPSApp/Program.cs index 9b17a43..4a0acbb 100644 --- a/OnPSApp/Program.cs +++ b/OnPSApp/Program.cs @@ -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;