Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
add update failed message to spcode
Browse files Browse the repository at this point in the history
  • Loading branch information
maxijabase committed Dec 26, 2021
1 parent 2365167 commit d08f8e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 11 additions & 2 deletions Deploy/SpcodeUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using ICSharpCode.SharpZipLib.Core;
Expand Down Expand Up @@ -85,14 +86,22 @@ private static void Worker(object arg)
}
catch (Exception ex)
{
MessageBox.Show($"The updater failed to update SPCode properly: {ex.Message}");
var sb = new StringBuilder();
sb.AppendLine("The updater failed to update SPCode properly.");
sb.AppendLine("=============================================");
sb.AppendLine($"Exception message: {ex.Message}");
sb.AppendLine("=============================================");
sb.AppendLine($"Stack trace:\n{ex.StackTrace}");
sb.AppendLine("=============================================");
var thread = new Thread(() => MessageBox.Show(sb.ToString()));
thread.Start();
Success = false;
}
finally
{
Process.Start(new ProcessStartInfo
{
Arguments = $"/C SPCode.exe {(Success ? "--updated" : string.Empty)}",
Arguments = $"/C SPCode.exe {(Success ? "--updateok" : "--updatefail")}",
FileName = "cmd",
WindowStyle = ProcessWindowStyle.Hidden
});
Expand Down
6 changes: 5 additions & 1 deletion UI/MainWindow/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,14 @@ public MainWindow(SplashScreen sc)
{
TryLoadSourceFile(args[i], out _, false, true, i == 0);
}
if (args[i].ToLowerInvariant() == "--updated")
if (args[i].ToLowerInvariant() == "--updateok")
{
this.ShowMessageAsync("Update completed", "SPCode has been updated successfully.");
}
if (args[i].ToLowerInvariant() == "--updatefail")
{
this.ShowMessageAsync("Update failed", "SPCode could not be updated properly.");
}
}

// Close SplashScreen
Expand Down

0 comments on commit d08f8e6

Please sign in to comment.