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

Commit d08f8e6

Browse files
committed
add update failed message to spcode
1 parent 2365167 commit d08f8e6

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Deploy/SpcodeUpdater/Program.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Diagnostics;
33
using System.IO;
44
using System.Linq;
5+
using System.Text;
56
using System.Threading;
67
using System.Windows.Forms;
78
using ICSharpCode.SharpZipLib.Core;
@@ -85,14 +86,22 @@ private static void Worker(object arg)
8586
}
8687
catch (Exception ex)
8788
{
88-
MessageBox.Show($"The updater failed to update SPCode properly: {ex.Message}");
89+
var sb = new StringBuilder();
90+
sb.AppendLine("The updater failed to update SPCode properly.");
91+
sb.AppendLine("=============================================");
92+
sb.AppendLine($"Exception message: {ex.Message}");
93+
sb.AppendLine("=============================================");
94+
sb.AppendLine($"Stack trace:\n{ex.StackTrace}");
95+
sb.AppendLine("=============================================");
96+
var thread = new Thread(() => MessageBox.Show(sb.ToString()));
97+
thread.Start();
8998
Success = false;
9099
}
91100
finally
92101
{
93102
Process.Start(new ProcessStartInfo
94103
{
95-
Arguments = $"/C SPCode.exe {(Success ? "--updated" : string.Empty)}",
104+
Arguments = $"/C SPCode.exe {(Success ? "--updateok" : "--updatefail")}",
96105
FileName = "cmd",
97106
WindowStyle = ProcessWindowStyle.Hidden
98107
});

UI/MainWindow/MainWindow.xaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,14 @@ public MainWindow(SplashScreen sc)
147147
{
148148
TryLoadSourceFile(args[i], out _, false, true, i == 0);
149149
}
150-
if (args[i].ToLowerInvariant() == "--updated")
150+
if (args[i].ToLowerInvariant() == "--updateok")
151151
{
152152
this.ShowMessageAsync("Update completed", "SPCode has been updated successfully.");
153153
}
154+
if (args[i].ToLowerInvariant() == "--updatefail")
155+
{
156+
this.ShowMessageAsync("Update failed", "SPCode could not be updated properly.");
157+
}
154158
}
155159

156160
// Close SplashScreen

0 commit comments

Comments
 (0)