|
1 | 1 | using NuGet.Common; |
| 2 | +using Reloaded.Mod.Launcher.Pages.BaseSubpages.Dialogs; |
2 | 3 | using Reloaded.Mod.Loader.Update.Providers.Web; |
3 | 4 | using Sewer56.DeltaPatchGenerator.Lib.Utility; |
4 | 5 | using Sewer56.Update.Extractors.SevenZipSharp; |
@@ -132,7 +133,48 @@ private async void InstallMod_Drop(object sender, DragEventArgs e) |
132 | 133 | foreach (var item in modConfigService.ItemsById.ToArray()) |
133 | 134 | { |
134 | 135 | if (!modsBefore.ContainsKey(item.Key)) |
| 136 | + { |
135 | 137 | newConfigs.Add(item.Value.Config); |
| 138 | + if(item.Value.Config.IsUniversalMod || item.Value.Config.SupportedAppId.Length > 0) |
| 139 | + { |
| 140 | + var match = Lib.IoC.Get<ApplicationConfigService>().Items.FirstOrDefault(app => item.Value.Config.SupportedAppId.Contains(app.Config.AppId)); |
| 141 | + if(match == null) |
| 142 | + { |
| 143 | + bool loadAppPage = Actions.DisplayMessagebox!.Invoke( |
| 144 | + NoCompatibleAppsInConfigTitle.Get(), |
| 145 | + $"{NoCompatibleAppsInConfigDescription.Get()}\n{AppSelectionQuestion.Get()}", |
| 146 | + new Actions.DisplayMessageBoxParams |
| 147 | + { |
| 148 | + Type = Actions.MessageBoxType.OkCancel |
| 149 | + }); |
| 150 | + if (loadAppPage) |
| 151 | + { |
| 152 | + var createModDialog = new EditModDialog(new EditModDialogViewModel(item.Value, Lib.IoC.Get<ApplicationConfigService>(), modConfigService)); |
| 153 | + createModDialog.Owner = System.Windows.Window.GetWindow(this); |
| 154 | + createModDialog.RealViewModel.Page = EditModPage.Special; |
| 155 | + createModDialog.ShowDialog(); |
| 156 | + } |
| 157 | + } |
| 158 | + } |
| 159 | + else |
| 160 | + { |
| 161 | + bool loadAppPage = Actions.DisplayMessagebox!.Invoke( |
| 162 | + NoAppsInConfigTitle.Get(), $"{NoAppsInConfigDescription.Get()}\n{AppSelectionQuestion.Get()}" |
| 163 | + , |
| 164 | + new Actions.DisplayMessageBoxParams |
| 165 | + { |
| 166 | + Type = Actions.MessageBoxType.OkCancel |
| 167 | + }); |
| 168 | + if (loadAppPage) |
| 169 | + { |
| 170 | + var createModDialog = new EditModDialog(new EditModDialogViewModel(item.Value, Lib.IoC.Get<ApplicationConfigService>(), modConfigService)); |
| 171 | + createModDialog.Owner = System.Windows.Window.GetWindow(this); |
| 172 | + createModDialog.RealViewModel.Page = EditModPage.Special; |
| 173 | + createModDialog.ShowDialog(); |
| 174 | + } |
| 175 | + } |
| 176 | + } |
| 177 | + |
136 | 178 | } |
137 | 179 |
|
138 | 180 | if (newConfigs.Count <= 0) |
|
0 commit comments