Skip to content

Commit

Permalink
Adding Squirrel.Windows to create packages releases and auto updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrab committed Mar 18, 2021
1 parent 8591f40 commit fc76569
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 1,759 deletions.
3 changes: 3 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="UpdateLocation" value="d:\slipstream\Releases"/>
</appSettings>
<userSettings>
<Slipstream.Properties.Settings>
<setting name="TwitchUsername" serializeAs="String">
Expand Down
24 changes: 24 additions & 0 deletions Frontend/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
using Slipstream.Components.UI.Events;
using Slipstream.Properties;
using Slipstream.Shared;
using Squirrel;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using EventHandler = Slipstream.Shared.EventHandlerController;

Expand Down Expand Up @@ -80,6 +83,9 @@ private void MainWindow_Load(object sender, EventArgs e)
EventBusSubscription = EventBus.RegisterListener(fromBeginning: true);
EventHandlerThread = new Thread(new ThreadStart(this.EventListenerMain));
EventHandlerThread.Start();

// ToDo: find a better place to put this
CheckForUpdates(); // not conserned about the outcome of this function
}

private void AppendMessages(string msg)
Expand Down Expand Up @@ -256,5 +262,23 @@ private void OpenDataDirectoryToolStripMenuItem_Click(object sender, EventArgs e
{
Process.Start(".");
}

private async Task CheckForUpdates()
{
var updateLocation = ConfigurationManager.AppSettings["UpdateLocation"];

if(string.IsNullOrEmpty(updateLocation))
{
return;
}

// ToDo: tidy this up, allowing for using local folder and GitHub, can be done better, perhaps with DI and named instances
// pattern match should also be regex to allow for different url like http and www.
// NOTE: GitHub is untested at this point
using var manager = updateLocation.StartsWith("https://github.com") ?
await UpdateManager.GitHubUpdateManager(updateLocation) : new UpdateManager(updateLocation);

await manager.UpdateApp();
}
}
}
5 changes: 2 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("0.4.0")]
[assembly: AssemblyVersion("0.4.0")]
[assembly: AssemblyFileVersion("0.4.0")]
[assembly: InternalsVisibleTo("Slipstream.UnitTests")]
Loading

0 comments on commit fc76569

Please sign in to comment.