@@ -35,6 +35,8 @@ void AddThese(IEnumerable<string> mods)
3535
3636 ImmutableArray < string > checkThese = [ .. checkTheseSet ] ;
3737
38+ List < string > unsupportedModIds = [ ] ;
39+
3840 for ( int i = 0 ; i < checkThese . Length ; i ++ )
3941 {
4042 string modId = checkThese [ i ] ;
@@ -48,17 +50,7 @@ void AddThese(IEnumerable<string> mods)
4850 }
4951 catch ( ModNotSupported e )
5052 {
51- ModLock ? modLock = Context . Instance . ModlistLock . FirstOrDefault ( v => v . Id == modId ) ;
52- if ( modLock is not null )
53- {
54- string file = Context . Instance . GetModPath ( modLock ) ;
55- unsupportedMods . Add ( new ModUninstallInfo ( )
56- {
57- Reason = ModUninstallReason . NotSupported ,
58- LockEntry = modLock ,
59- File = File . Exists ( file ) ? file : null ,
60- } ) ;
61- }
53+ unsupportedModIds . Add ( modId ) ;
6254 Log . Error ( e ) ;
6355 continue ;
6456 }
@@ -75,6 +67,48 @@ void AddThese(IEnumerable<string> mods)
7567
7668 progressBar . Dispose ( ) ;
7769
70+ if ( unsupportedModIds . Count > 0 && Log . AskYesNo ( $ "Do you want to uninstall { unsupportedModIds . Count } unsupported mods?", true ) )
71+ {
72+ foreach ( string modId in unsupportedModIds )
73+ {
74+ string name = await ModrinthUtils . GetModName ( modId , ct ) ;
75+
76+ foreach ( ModLock other in Context . Instance . ModlistLock )
77+ {
78+ if ( other . Dependencies . Contains ( modId ) )
79+ {
80+ Log . Error ( $ "Mod { name } is unsupported but required by mod { await ModrinthUtils . GetModName ( other . Id , ct ) } ") ;
81+ }
82+ }
83+
84+ ModEntry ? mod = Context . Instance . Modlist . Mods . FirstOrDefault ( v => v . Id == modId ) ;
85+ if ( mod is not null ) Context . Instance . Modlist . Mods . Remove ( mod ) ;
86+
87+ ModLock ? modLock = Context . Instance . ModlistLock . FirstOrDefault ( v => v . Id == modId ) ;
88+ if ( modLock is not null )
89+ {
90+ string file = Context . Instance . GetModPath ( modLock ) ;
91+ unsupportedMods . Add ( new ModUninstallInfo ( )
92+ {
93+ Reason = ModUninstallReason . NotSupported ,
94+ LockEntry = modLock ,
95+ File = File . Exists ( file ) ? file : null ,
96+ Name = name ,
97+ } ) ;
98+ }
99+ else
100+ {
101+ unsupportedMods . Add ( new ModUninstallInfo ( )
102+ {
103+ Reason = ModUninstallReason . NotSupported ,
104+ LockEntry = null ,
105+ File = null ,
106+ Name = name ,
107+ } ) ;
108+ }
109+ }
110+ }
111+
78112 return new Changes ( )
79113 {
80114 Install = modUpdates . ToImmutable ( ) ,
0 commit comments