|
15 | 15 | using System.Windows.Media.Imaging; |
16 | 16 | using System.Windows.Threading; |
17 | 17 | using System.Xml; |
| 18 | +using ModAPI_Installers.Types; |
18 | 19 |
|
19 | 20 | namespace Spore_ModAPI_Easy_Installer |
20 | 21 | { |
@@ -62,7 +63,7 @@ public partial class XmlInstallerWindow : DecoratableWindow |
62 | 63 |
|
63 | 64 | public static string SporeDataPath = SporePath.MoveToData(SporePath.Game.Spore, SporePath.GetRealParent(PathDialogs.ProcessSpore())); |
64 | 65 |
|
65 | | - private EasyInstaller.ResultType _result = EasyInstaller.ResultType.ModNotInstalled; |
| 66 | + private ResultType _result = ResultType.ModNotInstalled; |
66 | 67 |
|
67 | 68 | public XmlInstallerWindow(string modName, bool configure, bool uninstall) |
68 | 69 | { |
@@ -96,7 +97,7 @@ public XmlInstallerWindow(string modName, bool configure, bool uninstall) |
96 | 97 | } |
97 | 98 | } |
98 | 99 |
|
99 | | - public EasyInstaller.ResultType GetResult() |
| 100 | + public ResultType GetResult() |
100 | 101 | { |
101 | 102 | return _result; |
102 | 103 | } |
@@ -690,7 +691,7 @@ await Dispatcher.BeginInvoke(new Action(() => |
690 | 691 | XmlInstallerCancellation.Cancellation[ModName] = true; |
691 | 692 | _installerState = 2; |
692 | 693 | _installerMode = 1; |
693 | | - _result = EasyInstaller.ResultType.ModNotInstalled; |
| 694 | + _result = ResultType.ModNotInstalled; |
694 | 695 | Close(); |
695 | 696 | } |
696 | 697 |
|
@@ -879,19 +880,19 @@ await Task.Run(() => |
879 | 880 | if (_installerMode == 1) |
880 | 881 | { |
881 | 882 | _installerState = 2; |
882 | | - _result = EasyInstaller.ResultType.Success; |
| 883 | + _result = ResultType.Success; |
883 | 884 | Close(); |
884 | 885 | } |
885 | 886 | else |
886 | 887 | { |
887 | 888 | CyclePage(0, 1); |
888 | | - _result = EasyInstaller.ResultType.Success; |
| 889 | + _result = ResultType.Success; |
889 | 890 | _installerState = 2; |
890 | 891 | } |
891 | 892 | } |
892 | 893 | catch (Exception ex) |
893 | 894 | { |
894 | | - _result = EasyInstaller.ResultType.ModNotInstalled; |
| 895 | + _result = ResultType.ModNotInstalled; |
895 | 896 | ErrorInfoTextBlock.Text = ex.ToString(); |
896 | 897 | CyclePage(0, 3); |
897 | 898 | } |
@@ -1046,12 +1047,18 @@ await Task.Run(() => |
1046 | 1047 |
|
1047 | 1048 | if (_isUninstallingOnly) |
1048 | 1049 | { |
| 1050 | + _result = ResultType.Success; |
1049 | 1051 | Close(); |
1050 | 1052 | } |
1051 | | - //Process.GetCurrentProcess().Kill(); |
1052 | 1053 | } |
1053 | 1054 | catch (Exception ex) |
1054 | 1055 | { |
| 1056 | + // dummy error so that the uninstaller |
| 1057 | + // knows this mod failed to uninstall |
| 1058 | + if (_isUninstallingOnly) |
| 1059 | + { |
| 1060 | + _result = ResultType.UnsupportedFile; |
| 1061 | + } |
1055 | 1062 | ErrorInfoTextBlock.Text = ex.ToString(); |
1056 | 1063 | CyclePage(0, 3); |
1057 | 1064 | } |
@@ -1397,7 +1404,7 @@ private void XmlInstallerWindow_Closed(object sender, EventArgs e) |
1397 | 1404 | if (installerWindows.Contains(this)) |
1398 | 1405 | installerWindows.Remove(this); |
1399 | 1406 | if (_isConfigurator) |
1400 | | - Process.GetCurrentProcess().Kill(); |
| 1407 | + Environment.Exit((int)_result); |
1401 | 1408 | } |
1402 | 1409 |
|
1403 | 1410 | private void SplashBorder_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
0 commit comments