|
6 | 6 | using UniGetUI.PackageEngine.Classes.Packages.Classes; |
7 | 7 | using UniGetUI.PackageEngine.Enums; |
8 | 8 | using UniGetUI.PackageEngine.Interfaces; |
| 9 | +using UniGetUI.PackageEngine.PackageClasses; |
9 | 10 | using Architecture = UniGetUI.PackageEngine.Enums.Architecture; |
10 | 11 | using InstallOptions = UniGetUI.PackageEngine.Serializable.InstallOptions; |
11 | 12 |
|
@@ -147,7 +148,7 @@ protected override OperationVeredict _getOperationResult( |
147 | 148 |
|
148 | 149 | if (uintCode is 0x8A150109) |
149 | 150 | { // TODO: Restart required to finish installation |
150 | | - if (operation is OperationType.Update) MarkUpgradeAsDone(package); |
| 151 | + if (operation is OperationType.Update or OperationType.Install) MarkUpgradeAsDone(package); |
151 | 152 | return OperationVeredict.Success; |
152 | 153 | } |
153 | 154 |
|
@@ -180,13 +181,13 @@ protected override OperationVeredict _getOperationResult( |
180 | 181 |
|
181 | 182 | if (uintCode is 0x8A15010D or 0x8A15004F or 0x8A15010E) |
182 | 183 | { // Application is already installed |
183 | | - if (operation is OperationType.Update) MarkUpgradeAsDone(package); |
| 184 | + if (operation is OperationType.Update or OperationType.Install) MarkUpgradeAsDone(package); |
184 | 185 | return OperationVeredict.Success; |
185 | 186 | } |
186 | 187 |
|
187 | 188 | if (returnCode is 0) |
188 | 189 | { // Operation succeeded |
189 | | - if (operation is OperationType.Update) MarkUpgradeAsDone(package); |
| 190 | + if (operation is OperationType.Update or OperationType.Install) MarkUpgradeAsDone(package); |
190 | 191 | return OperationVeredict.Success; |
191 | 192 | } |
192 | 193 |
|
@@ -214,7 +215,12 @@ protected override OperationVeredict _getOperationResult( |
214 | 215 |
|
215 | 216 | private static void MarkUpgradeAsDone(IPackage package) |
216 | 217 | { |
217 | | - Settings.SetDictionaryItem<string, string>(Settings.K.WinGetAlreadyUpgradedPackages, package.Id, package.NewVersionString); |
| 218 | + var options = InstallOptionsFactory.LoadApplicable(package); |
| 219 | + string version; |
| 220 | + if (package.IsUpgradable) version = package.NewVersionString; |
| 221 | + else if (options.Version != "") version = options.Version; |
| 222 | + else version = package.VersionString; |
| 223 | + Settings.SetDictionaryItem<string, string>(Settings.K.WinGetAlreadyUpgradedPackages, package.Id, version); |
218 | 224 | } |
219 | 225 |
|
220 | 226 | public static bool UpdateAlreadyInstalled(IPackage package) |
|
0 commit comments