Added squirrel awareness to include additional net exception.

This commit is contained in:
Patrick Fic
2020-11-24 12:03:05 -08:00
parent 6fc24c08a6
commit 7967032fae
4 changed files with 49 additions and 3 deletions

View File

@@ -396,6 +396,7 @@
<Compile Include="Utils\Queries\VehicleQueries.cs" />
<Compile Include="Utils\QuickBooksInterop.cs" />
<Compile Include="Utils\RelayCommand.cs" />
<Compile Include="Utils\SquirrelAwareHelper.cs" />
<Compile Include="Utils\TrayIcon.cs" />
<Compile Include="Utils\UiConverters.cs" />
<Compile Include="Utils\UpdateHandler.cs" />

View File

@@ -7,11 +7,11 @@ using System.Windows;
// 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("BodyshopPartner")]
[assembly: AssemblyTitle("ImEX Online Partner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Snapt Software Inc.")]
[assembly: AssemblyProduct("BodyshopPartner")]
[assembly: AssemblyCompany("ImEX Systems Inc. & Snapt Software Inc.")]
[assembly: AssemblyProduct("ImEX Online Partner")]
[assembly: AssemblyCopyright("Copyright © Snapt Software Inc. 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -53,3 +53,5 @@ using System.Windows;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//Setting Squirrel Aware Version.
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Squirrel;
namespace BodyshopPartner.Utils
{
public static class SquirrelAwareHelper
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public static void InitializeSquirrelAware()
{
using (var mgr = new UpdateManager(Utils.UpdateHandler.UpdatePath))
{
// Note, in most of these scenarios, the app exits after this method
// completes!
SquirrelAwareApp.HandleEvents(
onInitialInstall: v =>
{
logger.Debug("Installing via Squirrel Aware Helper. ", v);
logger.Debug("Attempting to add HTTP Exclusion for web-server");
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "add netsh http add urlacl url=http://+:1337/ user=\"Everyone\"";
startInfo.Verb = "runas";
process.StartInfo = startInfo;
process.Start();
mgr.CreateShortcutForThisExe();
},
onAppUpdate: v => mgr.CreateShortcutForThisExe(),
onAppUninstall: v => mgr.RemoveShortcutForThisExe(),
onFirstRun: () => { logger.Info("We've run for the first time."); });
}
}
}
}

View File

@@ -22,6 +22,7 @@ namespace BodyshopPartner.Views
{
public Login()
{
Utils.SquirrelAwareHelper.InitializeSquirrelAware();
Utils.UpdateHandler.RestoreSettings();
Properties.Settings.Default.Reload();