Updates to logging and v1.0.3 release.
This commit is contained in:
@@ -9,6 +9,7 @@ using Newtonsoft;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using BodyshopPartner.Models;
|
||||
using ToastNotifications.Messages;
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
@@ -33,9 +34,31 @@ namespace BodyshopPartner.Utils
|
||||
|
||||
logger.Trace("Starting HTTP server...");
|
||||
hlog = HttpLogger;
|
||||
hlog("Starting HTTP server...");
|
||||
|
||||
//TODO As a part of the installer, add netsh http add urlacl url=http://+:1337/ user="Everyone
|
||||
HttpServer.ListenAsync(1337, System.Threading.CancellationToken.None, Route.OnHttpRequestAsync).Wait();
|
||||
try
|
||||
{
|
||||
HttpServer.ListenAsync(1337, System.Threading.CancellationToken.None, Route.OnHttpRequestAsync).Wait();
|
||||
hlog("ImEX Online connection server started...");
|
||||
}
|
||||
catch (Exception Ex)
|
||||
{
|
||||
logger.Fatal("Unable to start HTTP server. " + Ex.ToString());
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
string msg = "Unable to connect to ImEX Online Web App. Please ensure your firewall allows the connection.";
|
||||
hlog("ImEX Online connection server could not start. Please restart the partner to try again.");
|
||||
Utils.Notifications.notifier.ShowError(msg);
|
||||
bool AddedException = Utils.SquirrelAwareHelper.AddHttpExcetion();
|
||||
|
||||
//Growler.AddNotification(new Notification()
|
||||
//{
|
||||
// Title = Properties.Resources.Msg_NewJobUploaded,
|
||||
// Subtitle = item.Job?.ownr_fn?.Value + " " + item.Job?.ownr_ln?.Value + " | " + item.Job?.clm_no?.Value,
|
||||
// //Message = item.Job?.vehicle?.data?.v_model_yr?.Value + " " + item.Job?.vehicle?.data?.v_make_desc?.Value + " " + item.Job?.vehicle?.data?.v_model_desc?.Value
|
||||
//});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleQbPost(System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse res)
|
||||
|
||||
@@ -10,6 +10,19 @@ namespace BodyshopPartner.Utils
|
||||
{
|
||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static bool AddHttpExcetion()
|
||||
{
|
||||
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 = "netsh http add urlacl url=http://+:1337/ user=\"Everyone\"";
|
||||
startInfo.Verb = "runas";
|
||||
process.StartInfo = startInfo;
|
||||
return process.Start();
|
||||
}
|
||||
|
||||
public static void InitializeSquirrelAware()
|
||||
{
|
||||
using (var mgr = new UpdateManager(Utils.UpdateHandler.UpdatePath))
|
||||
@@ -22,15 +35,8 @@ namespace BodyshopPartner.Utils
|
||||
logger.Debug("Installing via Squirrel Aware Helper. ", v);
|
||||
try
|
||||
{
|
||||
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;
|
||||
bool successful = process.Start();
|
||||
|
||||
bool successful = AddHttpExcetion();
|
||||
|
||||
if (successful)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,9 @@ namespace BodyshopPartner.Utils
|
||||
logger.Debug("No releases to apply.");
|
||||
return false;
|
||||
}
|
||||
|
||||
updateInfo.ReleasesToApply.ForEach(release => logger.Debug("Release to apply " + release.Version));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -53,11 +56,23 @@ namespace BodyshopPartner.Utils
|
||||
|
||||
using (var updateManager = new UpdateManager(UpdatePath))
|
||||
{
|
||||
var updateInfo = await updateManager.CheckForUpdate();
|
||||
var releases = updateInfo.ReleasesToApply;
|
||||
logger.Debug("Applying releases", releases.ToString());
|
||||
await updateManager.DownloadReleases(releases, _ => { DownloadProgress = _; });
|
||||
await updateManager.ApplyReleases(updateInfo, _ => { InstallProgress = _; });
|
||||
try
|
||||
{
|
||||
var updateInfo = await updateManager.CheckForUpdate();
|
||||
var releases = updateInfo.ReleasesToApply;
|
||||
logger.Debug("Applying releases", releases.ToString());
|
||||
await updateManager.DownloadReleases(releases, _ => {
|
||||
logger.Debug("Download Release Progress " + _.ToString());
|
||||
DownloadProgress = _; });
|
||||
await updateManager.ApplyReleases(updateInfo, _ => {
|
||||
logger.Debug("Install Progress " + _.ToString());
|
||||
InstallProgress = _; });
|
||||
}
|
||||
catch (Exception Ex)
|
||||
{
|
||||
logger.Error("Error updating Partner App. " + Ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user