@@ -41,9 +41,13 @@ public class Main : ISettingProvider, IAsyncPlugin, IPluginI18n, IContextMenu, I
41
41
"uninst000.exe" ,
42
42
"uninstall.exe"
43
43
} ;
44
- // For cases when the uninstaller is named like "Uninstall Program Name.exe"
45
- private const string CommonUninstallerPrefix = "uninstall" ;
46
- private const string CommonUninstallerSuffix = ".exe" ;
44
+ private static readonly string [ ] commonUninstallerPrefixs =
45
+ {
46
+ "uninstall" ,
47
+ "卸载"
48
+ } ;
49
+ private const string ExeUninstallerSuffix = ".exe" ;
50
+ private const string InkUninstallerSuffix = ".lnk" ;
47
51
48
52
static Main ( )
49
53
{
@@ -96,10 +100,33 @@ private bool HideUninstallersFilter(IProgram program)
96
100
{
97
101
if ( ! _settings . HideUninstallers ) return true ;
98
102
if ( program is not Win32 win32 ) return true ;
103
+
104
+ // First check the executable path
99
105
var fileName = Path . GetFileName ( win32 . ExecutablePath ) ;
100
- return ! commonUninstallerNames . Contains ( fileName , StringComparer . OrdinalIgnoreCase ) &&
101
- ! ( fileName . StartsWith ( CommonUninstallerPrefix , StringComparison . OrdinalIgnoreCase ) &&
102
- fileName . EndsWith ( CommonUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) ) ;
106
+ // For cases when the uninstaller is named like "uninst.exe"
107
+ if ( commonUninstallerNames . Contains ( fileName , StringComparer . OrdinalIgnoreCase ) ) return false ;
108
+ // For cases when the uninstaller is named like "Uninstall Program Name.exe"
109
+ foreach ( var prefix in commonUninstallerPrefixs )
110
+ {
111
+ if ( fileName . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) &&
112
+ fileName . EndsWith ( ExeUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) )
113
+ return false ;
114
+ }
115
+
116
+ // Second check the ink path
117
+ if ( ! string . IsNullOrEmpty ( win32 . LnkResolvedPath ) )
118
+ {
119
+ var inkFileName = Path . GetFileName ( win32 . FullPath ) ;
120
+ // For cases when the uninstaller is named like "Uninstall Program Name.ink"
121
+ foreach ( var prefix in commonUninstallerPrefixs )
122
+ {
123
+ if ( inkFileName . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) &&
124
+ inkFileName . EndsWith ( InkUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) )
125
+ return false ;
126
+ }
127
+ }
128
+
129
+ return true ;
103
130
}
104
131
105
132
public async Task InitAsync ( PluginInitContext context )
0 commit comments