diff --git a/BodyshopUploader/BodyshopPartner.csproj b/BodyshopUploader/BodyshopPartner.csproj index ff30e96..e5c7db1 100644 --- a/BodyshopUploader/BodyshopPartner.csproj +++ b/BodyshopUploader/BodyshopPartner.csproj @@ -396,6 +396,7 @@ + diff --git a/BodyshopUploader/Properties/AssemblyInfo.cs b/BodyshopUploader/Properties/AssemblyInfo.cs index 38f935c..f60b4b7 100644 --- a/BodyshopUploader/Properties/AssemblyInfo.cs +++ b/BodyshopUploader/Properties/AssemblyInfo.cs @@ -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")] \ No newline at end of file diff --git a/BodyshopUploader/Utils/SquirrelAwareHelper.cs b/BodyshopUploader/Utils/SquirrelAwareHelper.cs new file mode 100644 index 0000000..28abbb5 --- /dev/null +++ b/BodyshopUploader/Utils/SquirrelAwareHelper.cs @@ -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."); }); + } + } + } +} diff --git a/BodyshopUploader/Views/Login.xaml.cs b/BodyshopUploader/Views/Login.xaml.cs index d159360..685300e 100644 --- a/BodyshopUploader/Views/Login.xaml.cs +++ b/BodyshopUploader/Views/Login.xaml.cs @@ -22,6 +22,7 @@ namespace BodyshopPartner.Views { public Login() { + Utils.SquirrelAwareHelper.InitializeSquirrelAware(); Utils.UpdateHandler.RestoreSettings(); Properties.Settings.Default.Reload();