@@ -225,6 +225,7 @@ private static async Task LoadPrivateMods(CancellationTokenSource? cancellationT
225225 }
226226 }
227227 }
228+ //Remove Installed and FS2 parent mods if FS2 root pack is not detected, Mark update avalible to installed ones
228229 if ( mod . type == ModType . tc || mod . type == ModType . mod && ( listFS2Override || mod . parent != "FS2" || mod . parent == "FS2" && Knossos . retailFs2RootFound ) )
229230 {
230231
@@ -388,18 +389,24 @@ private static bool IsModUpdate(Mod mod)
388389
389390 //Mods, TCs
390391 var modsTcs = newerestModVersionPerID . Where ( m => m . type == ModType . mod || m . type == ModType . tc ) . ToList ( ) ;
391- //Remove Installed, Mark update avalible to installed ones
392+ //Remove Installed and FS2 parent mods if FS2 root pack is not detected , Mark update avalible to installed ones, set installed ones as inNebula
392393 foreach ( var m in modsTcs . ToList ( ) )
393394 {
394- if ( m . type == ModType . tc || m . type == ModType . mod && ( listFS2Override || m . parent != "FS2" || m . parent == "FS2" && Knossos . retailFs2RootFound ) )
395+
396+ if ( listFS2Override || ( m . parent != "FS2" || m . parent == "FS2" && Knossos . retailFs2RootFound ) )
395397 {
396398 //This is already installed?
397399 var isInstalled = Knossos . GetInstalledModList ( m . id ) ;
398400 if ( isInstalled != null && isInstalled . Any ( ) )
399401 {
400- var versionInNebula = isInstalled . FirstOrDefault ( x => x . version == m . version ) ;
401- if ( versionInNebula != null )
402- versionInNebula . inNebula = true ;
402+ //Set installed mods that are uploded to Nebula as "inNebula=true"
403+ isInstalled . ForEach ( mod =>
404+ {
405+ if ( mod != null && allModsInRepo . FirstOrDefault ( repo => repo . id == mod . id && repo . version == mod . version ) != null )
406+ {
407+ mod . inNebula = true ;
408+ }
409+ } ) ;
403410 var newer = isInstalled . MaxBy ( x => new SemanticVersion ( x . version ) ) ;
404411 if ( newer != null && new SemanticVersion ( newer . version ) < new SemanticVersion ( m . version ) )
405412 {
@@ -408,6 +415,10 @@ private static bool IsModUpdate(Mod mod)
408415 modsTcs . Remove ( m ) ;
409416 }
410417 }
418+ else
419+ {
420+ modsTcs . Remove ( m ) ;
421+ }
411422 } ;
412423
413424 await Dispatcher . UIThread . InvokeAsync ( ( ) => MainWindowViewModel . Instance ! . BulkLoadNebulaMods ( modsTcs , true ) , DispatcherPriority . Background ) ;
0 commit comments