Skip to content

Commit

Permalink
Updated updater handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fma965 committed Jan 2, 2021
1 parent 0a8234e commit a06813c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
6 changes: 1 addition & 5 deletions ApplicationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,8 @@ public void Initialize()
Settings.Default.UpgradeRequired = false;
Settings.Default.Save();
}

if (!Debugger.IsAttached)
{
AutoUpdaterHelper unused = new AutoUpdaterHelper();
}


Logger.Debug("Syn3 Updater is Starting");
// ReSharper disable once IdentifierTypo
// ReSharper disable once UnusedVariable
Expand Down
18 changes: 16 additions & 2 deletions Helper/AppUpdateHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,37 @@ public AutoUpdaterHelper()
private static void AutoUpdaterOnParseUpdateInfoEvent(ParseUpdateInfoEventArgs args)
{
{
string asseturl = "";
dynamic json = JsonConvert.DeserializeObject(args.RemoteData);
foreach (var asset in json.assets)
{

string browser_download_url = asset.browser_download_url.ToString();
if (browser_download_url.Contains(".zip"))
{
asseturl = asset.browser_download_url;
break;
}

}
if (json != null)
{
args.UpdateInfo = new UpdateInfoEventArgs
{
ChangelogURL = Api.UpdaterChangelogURL,
CheckSum = null,
CurrentVersion = json.tag_name.ToString()
.Replace("v",
""),
DownloadURL = json.assets[0]
.browser_download_url,
DownloadURL = asseturl,
Error = null,
InstalledVersion = null,
InstallerArgs = null,
IsUpdateAvailable = false,
Mandatory = null
};
}

}
}

Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
// You can specify all the values or you can default the Build a nd Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
3 changes: 2 additions & 1 deletion UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System;
using System.ComponentModel;
using System.Net;
using System.Reflection;
using System.Windows.Controls;
Expand Down
3 changes: 3 additions & 0 deletions UI/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Windows;
using FontAwesome5;
using ModernWpf;
using Syn3Updater.Helper;
using Syn3Updater.Model;
using Syn3Updater.Properties;
using ElementTheme = SourceChord.FluentWPF.ElementTheme;
Expand Down Expand Up @@ -61,6 +62,8 @@ public MainWindowViewModel()
ApplicationManager.Instance.ShowSettingsTab += delegate { CurrentTab = "settings"; };
ApplicationManager.Instance.ShowHomeTab += delegate { CurrentTab = "home"; };
ApplicationManager.Instance.ShowUtilityTab += delegate { CurrentTab = "utility"; };

AutoUpdaterHelper unused = new AutoUpdaterHelper();
}

#endregion
Expand Down

0 comments on commit a06813c

Please sign in to comment.