diff --git a/osu-framework b/osu-framework index 16cc4a53a0..e776f6f272 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 16cc4a53a0447264b8f67f149da701c4f00a41ea +Subproject commit e776f6f2729bbe93206c4e8c089eeca57522fcf7 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index cc9201c1fd..77b313f4ad 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -88,13 +88,13 @@ namespace osu.Desktop.VisualTests.Tests if (n.Progress < 1) n.Progress += (float)(Time.Elapsed / 2000) * RNG.NextSingle(); else - n.Complete(); + n.State = ProgressNotificationState.Completed; } } private void sendProgress2() { - var n = new ProgressNotification(@"Downloading Haitai..."); + var n = new ProgressNotification { Text = @"Downloading Haitai..." }; manager.Post(n); progressingNotifications.Add(n); } @@ -103,19 +103,19 @@ namespace osu.Desktop.VisualTests.Tests private void sendProgress1() { - var n = new ProgressNotification(@"Uploading to BSS..."); + var n = new ProgressNotification { Text = @"Uploading to BSS..." }; manager.Post(n); progressingNotifications.Add(n); } private void sendNotification2() { - manager.Post(new SimpleNotification(@"You are amazing")); + manager.Post(new SimpleNotification { Text = @"You are amazing" }); } private void sendNotification1() { - manager.Post(new SimpleNotification(@"Welcome to osu!. Enjoy your stay!")); + manager.Post(new SimpleNotification { Text = @"Welcome to osu!. Enjoy your stay!" }); } } } diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 5edeffd448..167d4644b7 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -11,6 +11,9 @@ using System.Windows.Forms; using osu.Framework.Platform; using osu.Framework.Desktop.Platform; using osu.Game.Database; +using osu.Desktop.Overlays; +using System.Reflection; +using System.Drawing; namespace osu.Desktop { @@ -22,12 +25,22 @@ namespace osu.Desktop } + protected override void LoadComplete() + { + base.LoadComplete(); + + (new VersionManager()).Preload(this, Add); + } + public override void SetHost(BasicGameHost host) { base.SetHost(host); var desktopWindow = host.Window as DesktopGameWindow; if (desktopWindow != null) { + desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); + desktopWindow.Title = @"osu!lazer"; + desktopWindow.DragEnter += dragEnter; desktopWindow.DragDrop += dragDrop; } diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs new file mode 100644 index 0000000000..a3648e1f12 --- /dev/null +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -0,0 +1,93 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osu.Game.Overlays.Notifications; +using Squirrel; +using System.Reflection; + +namespace osu.Desktop.Overlays +{ + public class VersionManager : OverlayContainer + { + private UpdateManager updateManager; + private NotificationManager notification; + + [BackgroundDependencyLoader] + private void load(NotificationManager notification) + { + this.notification = notification; + + AutoSizeAxes = Axes.Both; + Anchor = Anchor.BottomCentre; + Origin = Anchor.BottomCentre; + + var asm = Assembly.GetEntryAssembly().GetName(); + Add(new OsuSpriteText + { + Text = $@"osu!lazer v{asm.Version}" + }); + + updateChecker(); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + State = Visibility.Visible; + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + updateManager?.Dispose(); + } + + private async void updateChecker() + { + updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true); + var info = await updateManager.CheckForUpdate(); + if (info.ReleasesToApply.Count > 0) + { + ProgressNotification n = new UpdateProgressNotification + { + Text = @"Downloading update..." + }; + Schedule(() => notification.Post(n)); + Schedule(() => n.State = ProgressNotificationState.Active); + await updateManager.DownloadReleases(info.ReleasesToApply, (int p) => Schedule(() => n.Progress = p / 100f)); + Schedule(() => n.Text = @"Installing update..."); + await updateManager.ApplyReleases(info, (int p) => Schedule(() => n.Progress = p / 100f)); + Schedule(() => n.State = ProgressNotificationState.Completed); + + } + else + { + //check again every 30 minutes. + Scheduler.AddDelayed(updateChecker, 60000 * 30); + } + } + + protected override void PopIn() + { + } + + protected override void PopOut() + { + } + + class UpdateProgressNotification : ProgressNotification + { + protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification(this) + { + Text = @"Update ready to install. Click to restart!", + Activated = () => + { + UpdateManager.RestartApp(); + return true; + } + }; + } + } +} diff --git a/osu.Desktop/Properties/AssemblyInfo.cs b/osu.Desktop/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d7391080a6 --- /dev/null +++ b/osu.Desktop/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("osu!lazer")] +[assembly: AssemblyDescription("click the circles. to the beat.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("ppy Pty Ltd")] +[assembly: AssemblyProduct("osu!lazer")] +[assembly: AssemblyCopyright("ppy Pty Ltd 2007-2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("55e28cb2-7b6c-4595-8dcc-9871d8aad7e9")] + +[assembly: AssemblyVersion("0.0.3")] +[assembly: AssemblyFileVersion("0.0.3")] diff --git a/osu.Desktop/app.config b/osu.Desktop/app.config new file mode 100644 index 0000000000..44ccc4b77a --- /dev/null +++ b/osu.Desktop/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index b8d6ca7ac4..2ab913d706 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -79,19 +79,73 @@ false - osu!.res + + + + + lazer.ico + + + Properties\app.manifest + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll + True + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.MsDelta.dll + True + + + ..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.PatchApi.dll + True + + + ..\packages\squirrel.windows.1.5.2\lib\Net45\ICSharpCode.SharpZipLib.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll + True + + + ..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll + True + + + ..\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll + True + + + ..\packages\Splat.1.6.2\lib\Net45\Splat.dll + True + + + ..\packages\squirrel.windows.1.5.2\lib\Net45\Squirrel.dll + True + + osu.licenseheader + + @@ -157,10 +211,14 @@ + + + + + -