Permalink
Browse files

add squirrel

  • Loading branch information...
1 parent 80ed80c commit 7655672740ad69d793774a761b957c55974d3212 @azeier azeier committed Jul 11, 2016
View
@@ -158,5 +158,6 @@ Hearthstone Deck Tracker.sln.ide/*
packages/*
!packages/repositories.config
+Hearthstone Deck Tracker/Releases
HearthDb/
HearthMirror/
@@ -35,6 +35,15 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Squirrel|AnyCPU'">
+ <OutputPath>bin\Squirrel\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
@@ -54,6 +63,15 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Squirrel|x86'">
+ <OutputPath>bin\x86\Squirrel\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll</HintPath>
@@ -125,11 +143,11 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
-->
</Project>
@@ -34,6 +34,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Squirrel|AnyCPU'">
+ <OutputPath>bin\Squirrel\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
@@ -55,6 +65,16 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Squirrel|x86'">
+ <OutputPath>bin\x86\Squirrel\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -116,11 +136,11 @@
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
-->
</Project>
@@ -50,6 +50,16 @@
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Squirrel|AnyCPU'">
+ <OutputPath>bin\Squirrel\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
@@ -71,6 +81,16 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Squirrel|x86'">
+ <OutputPath>bin\x86\Squirrel\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -108,11 +128,11 @@
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
-->
</Project>
@@ -25,24 +25,33 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
+ Squirrel|x86 = Squirrel|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E63A3F1C-E662-4E62-BE43-AF27CB9E953D}.Debug|x86.ActiveCfg = Debug|x86
{E63A3F1C-E662-4E62-BE43-AF27CB9E953D}.Debug|x86.Build.0 = Debug|x86
{E63A3F1C-E662-4E62-BE43-AF27CB9E953D}.Release|x86.ActiveCfg = Release|x86
{E63A3F1C-E662-4E62-BE43-AF27CB9E953D}.Release|x86.Build.0 = Release|x86
+ {E63A3F1C-E662-4E62-BE43-AF27CB9E953D}.Squirrel|x86.ActiveCfg = Squirrel|x86
+ {E63A3F1C-E662-4E62-BE43-AF27CB9E953D}.Squirrel|x86.Build.0 = Squirrel|x86
{A99438AD-6733-4FDA-928C-30C37255FF1B}.Debug|x86.ActiveCfg = Debug|x86
{A99438AD-6733-4FDA-928C-30C37255FF1B}.Debug|x86.Build.0 = Debug|x86
{A99438AD-6733-4FDA-928C-30C37255FF1B}.Release|x86.ActiveCfg = Release|x86
{A99438AD-6733-4FDA-928C-30C37255FF1B}.Release|x86.Build.0 = Release|x86
+ {A99438AD-6733-4FDA-928C-30C37255FF1B}.Squirrel|x86.ActiveCfg = Squirrel|x86
+ {A99438AD-6733-4FDA-928C-30C37255FF1B}.Squirrel|x86.Build.0 = Squirrel|x86
{4DA33EE8-3F32-4D91-82FA-3BC7F014263D}.Debug|x86.ActiveCfg = Debug|x86
{4DA33EE8-3F32-4D91-82FA-3BC7F014263D}.Debug|x86.Build.0 = Debug|x86
{4DA33EE8-3F32-4D91-82FA-3BC7F014263D}.Release|x86.ActiveCfg = Release|x86
{4DA33EE8-3F32-4D91-82FA-3BC7F014263D}.Release|x86.Build.0 = Release|x86
+ {4DA33EE8-3F32-4D91-82FA-3BC7F014263D}.Squirrel|x86.ActiveCfg = Squirrel|x86
+ {4DA33EE8-3F32-4D91-82FA-3BC7F014263D}.Squirrel|x86.Build.0 = Squirrel|x86
{245A59F5-6E48-4B5B-B828-24A4C3EED309}.Debug|x86.ActiveCfg = Debug|x86
{245A59F5-6E48-4B5B-B828-24A4C3EED309}.Debug|x86.Build.0 = Debug|x86
{245A59F5-6E48-4B5B-B828-24A4C3EED309}.Release|x86.ActiveCfg = Release|x86
{245A59F5-6E48-4B5B-B828-24A4C3EED309}.Release|x86.Build.0 = Release|x86
+ {245A59F5-6E48-4B5B-B828-24A4C3EED309}.Squirrel|x86.ActiveCfg = Squirrel|x86
+ {245A59F5-6E48-4B5B-B828-24A4C3EED309}.Squirrel|x86.Build.0 = Squirrel|x86
{7ED14243-E02B-4B94-AF00-A67A62C282F0}.Debug|x86.ActiveCfg = Debug|x86
{7ED14243-E02B-4B94-AF00-A67A62C282F0}.Debug|x86.Build.0 = Debug|x86
{7ED14243-E02B-4B94-AF00-A67A62C282F0}.Release|x86.ActiveCfg = Release|x86
@@ -12,6 +12,7 @@
using Hearthstone_Deck_Tracker.Plugins;
using Hearthstone_Deck_Tracker.Utility.Extensions;
using Hearthstone_Deck_Tracker.Windows;
+using Squirrel;
#endregion
@@ -2,7 +2,9 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Design.Serialization;
using System.IO;
+using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using HearthMirror.Enums;
@@ -22,6 +24,7 @@
using Hearthstone_Deck_Tracker.Windows;
using MahApps.Metro.Controls.Dialogs;
using Hearthstone_Deck_Tracker.Utility.Themes;
+using Squirrel;
#endregion
@@ -51,19 +54,23 @@ public static class Core
internal static bool Update { get; set; }
internal static bool CanShutdown { get; set; }
- public static void Initialize()
+ public static async void Initialize()
{
- Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
- var newUser = !Directory.Exists(Config.AppDataPath);
Config.Load();
+ var splashScreenWindow = new SplashScreenWindow();
+ splashScreenWindow.ShowConditional();
+#if(SQUIRREL)
+ if(Config.Instance.CheckForUpdates)
+ await CheckForUpdates(splashScreenWindow);
+#endif
Log.Initialize();
+ Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
+ var newUser = !Directory.Exists(Config.AppDataPath);
ConfigManager.Run();
LogConfigUpdater.Run().Forget();
LogConfigWatcher.Start();
Helper.UpdateAppTheme();
ThemeManager.Run();
- var splashScreenWindow = new SplashScreenWindow();
- splashScreenWindow.ShowConditional();
Game = new GameV2();
LoginType loginType;
var loggedIn = HearthStatsAPI.LoadCredentials();
@@ -95,8 +102,10 @@ public static void Initialize()
splashScreenWindow.Close();
if(ConfigManager.UpdatedVersion != null)
- {
+ {
+#if(!SQUIRREL)
Updater.Cleanup();
+#endif
MainWindow.FlyoutUpdateNotes.IsOpen = true;
MainWindow.UpdateNotesControl.SetHighlight(ConfigManager.PreviousVersion);
MainWindow.UpdateNotesControl.LoadUpdateNotes();
@@ -148,11 +157,38 @@ public static void Initialize()
Influx.OnAppStart(Helper.GetCurrentVersion(), loginType, newUser);
}
+
+#if(SQUIRREL)
+ private static async Task CheckForUpdates(SplashScreenWindow splashScreenWindow)
+ {
+ try
+ {
+ bool restart;
+ using(var mgr = await UpdateManager.GitHubUpdateManager("https://github.com/Epix37/HDT-Releases", prerelease: Config.Instance.CheckForBetaUpdates))
+ {
+ SquirrelAwareApp.HandleEvents(
+ v => mgr.CreateShortcutForThisExe(),
+ v => mgr.CreateShortcutForThisExe(),
+ onAppUninstall: v => mgr.RemoveShortcutForThisExe()
+ );
+ restart = await mgr.UpdateApp(splashScreenWindow.Updating) != null;
+ }
+ if(restart)
+ UpdateManager.RestartApp();
+ }
+ catch(Exception ex)
+ {
+ Log.Error(ex);
+ }
+ }
+#endif
private static async void UpdateOverlayAsync()
- {
+ {
+#if(!SQUIRREL)
if(Config.Instance.CheckForUpdates)
- Updater.CheckForUpdates(true);
+ Updater.CheckForUpdates(true);
+#endif
var hsForegroundChanged = false;
var useNoDeckMenuItem = TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey("startHearthstone");
while(UpdateOverlay)
Oops, something went wrong.

0 comments on commit 7655672

Please sign in to comment.