@@ -41,9 +41,36 @@ 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" , //en
47
+ "卸载" , //zh-cn
48
+ "卸載" , //zh-tw
49
+ "видалити" , //uk-UA
50
+ "удалить" , //ru
51
+ "désinstaller" , //fr
52
+ "アンインストール" , //ja
53
+ "deïnstalleren" , //nl
54
+ "odinstaluj" , //pl
55
+ "afinstallere" , //da
56
+ "deinstallieren" , //de
57
+ "삭제" , //ko
58
+ "деинсталирај" , //sr
59
+ "desinstalar" , //pt-pt
60
+ "desinstalar" , //pt-br
61
+ "desinstalar" , //es
62
+ "desinstalar" , //es-419
63
+ "disinstallare" , //it
64
+ "avinstallere" , //nb-NO
65
+ "odinštalovať" , //sk
66
+ "kaldır" , //tr
67
+ "odinstalovat" , //cs
68
+ "إلغاء التثبيت" , //ar
69
+ "gỡ bỏ" , //vi-vn
70
+ "הסרה" //he
71
+ } ;
72
+ private const string ExeUninstallerSuffix = ".exe" ;
73
+ private const string InkUninstallerSuffix = ".lnk" ;
47
74
48
75
static Main ( )
49
76
{
@@ -96,10 +123,33 @@ private bool HideUninstallersFilter(IProgram program)
96
123
{
97
124
if ( ! _settings . HideUninstallers ) return true ;
98
125
if ( program is not Win32 win32 ) return true ;
126
+
127
+ // First check the executable path
99
128
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 ) ) ;
129
+ // For cases when the uninstaller is named like "uninst.exe"
130
+ if ( commonUninstallerNames . Contains ( fileName , StringComparer . OrdinalIgnoreCase ) ) return false ;
131
+ // For cases when the uninstaller is named like "Uninstall Program Name.exe"
132
+ foreach ( var prefix in commonUninstallerPrefixs )
133
+ {
134
+ if ( fileName . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) &&
135
+ fileName . EndsWith ( ExeUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) )
136
+ return false ;
137
+ }
138
+
139
+ // Second check the lnk path
140
+ if ( ! string . IsNullOrEmpty ( win32 . LnkResolvedPath ) )
141
+ {
142
+ var inkFileName = Path . GetFileName ( win32 . FullPath ) ;
143
+ // For cases when the uninstaller is named like "Uninstall Program Name.ink"
144
+ foreach ( var prefix in commonUninstallerPrefixs )
145
+ {
146
+ if ( inkFileName . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) &&
147
+ inkFileName . EndsWith ( InkUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) )
148
+ return false ;
149
+ }
150
+ }
151
+
152
+ return true ;
103
153
}
104
154
105
155
public async Task InitAsync ( PluginInitContext context )
0 commit comments