-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
106 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using fluXis.Game; | ||
using fluXis.Game.Graphics.Sprites; | ||
using fluXis.Game.Overlay.Notifications; | ||
using fluXis.Game.Overlay.Notifications.Tasks; | ||
using fluXis.Game.Updater; | ||
using osu.Framework.Logging; | ||
using Velopack; | ||
using Velopack.Sources; | ||
|
||
namespace fluXis.Desktop; | ||
|
||
public partial class VelopackUpdatePerformer : IUpdatePerformer | ||
{ | ||
private NotificationManager notifications { get; } | ||
private readonly Logger logger = Logger.GetLogger("update"); | ||
|
||
public VelopackUpdatePerformer(NotificationManager notifications) | ||
{ | ||
this.notifications = notifications; | ||
} | ||
|
||
public void Perform(bool silent, bool beta) | ||
{ | ||
if (FluXisGameBase.IsDebug) | ||
{ | ||
logger.Add("Skipping update in debug."); | ||
return; | ||
} | ||
|
||
logger.Add("Checking for updates..."); | ||
var mgr = new UpdateManager(new GithubSource("https://github.com/TeamFluXis/fluXis", "", beta)); | ||
|
||
var update = mgr.CheckForUpdates(); | ||
|
||
if (update is null) | ||
{ | ||
logger.Add("No update found."); | ||
|
||
if (!silent) | ||
notifications.SendText("No updates available.", "You are running the latest version.", FontAwesome6.Solid.Check); | ||
|
||
return; | ||
} | ||
|
||
var notification = new TaskNotificationData | ||
{ | ||
Text = "New update available!", | ||
TextWorking = "Downloading...", | ||
TextFailed = "Failed! Check update.log for more information.", | ||
TextFinished = "Done! Starting update..." | ||
}; | ||
|
||
notifications.AddTask(notification); | ||
logger.Add($"Downloading {update.TargetFullRelease.Version}..."); | ||
mgr.DownloadUpdates(update, i => notification.Progress = i / 100f); | ||
|
||
logger.Add("Applying..."); | ||
notification.State = LoadingState.Complete; | ||
mgr.ApplyUpdatesAndRestart(update); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace fluXis.Game.Updater.GitHub; | ||
|
||
public class GitHubAsset | ||
{ | ||
[JsonProperty("url")] | ||
public string Url { get; set; } = string.Empty; | ||
|
||
[JsonProperty("id")] | ||
public int Id { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public string Name { get; set; } = string.Empty; | ||
} |
Oops, something went wrong.