11using Caliburn . Micro ;
22using Microsoft . Win32 ;
33using System ;
4+ using System . Collections . Generic ;
45using System . Diagnostics ;
56using System . IO ;
67using System . Net . Http ;
@@ -19,22 +20,40 @@ public static bool IsRedistributablePackageInstalled()
1920 {
2021 if ( Environment . Is64BitProcess )
2122 {
22- var parametersVc2017X64 = Registry . ClassesRoot . OpenSubKey ( @"Installer\Dependencies\,,amd64,14.0,bundle" , false ) ;
23- var vc2017X64Version = parametersVc2017X64 ? . GetValue ( "Version" ) ;
24- if ( vc2017X64Version == null ) return false ;
25- if ( ( ( string ) vc2017X64Version ) . StartsWith ( "14" ) )
23+ var paths2017X64 = new List < string >
2624 {
27- return true ;
25+ @"Installer\Dependencies\,,amd64,14.0,bundle" ,
26+ @"Installer\Dependencies\VC,redist.x64,amd64,14.16,bundle" //changed in 14.16.x
27+ } ;
28+ foreach ( var path in paths2017X64 )
29+ {
30+ var parametersVc2017X64 = Registry . ClassesRoot . OpenSubKey ( path , false ) ;
31+ if ( parametersVc2017X64 == null ) continue ;
32+ var vc2017X64Version = parametersVc2017X64 . GetValue ( "Version" ) ;
33+ if ( vc2017X64Version == null ) return false ;
34+ if ( ( ( string ) vc2017X64Version ) . StartsWith ( "14" ) )
35+ {
36+ return true ;
37+ }
2838 }
2939 }
3040 else
3141 {
32- var parametersVc2017X86 = Registry . ClassesRoot . OpenSubKey ( @"Installer\Dependencies\,,x86,14.0,bundle" , false ) ;
33- var vc2017X86Version = parametersVc2017X86 ? . GetValue ( "Version" ) ;
34- if ( vc2017X86Version == null ) return false ;
35- if ( ( ( string ) vc2017X86Version ) . StartsWith ( "14" ) )
42+ var paths2017X86 = new List < string >
43+ {
44+ @"Installer\Dependencies\,,x86,14.0,bundle" ,
45+ @"Installer\Dependencies\VC,redist.x86,x86,14.16,bundle" //changed in 14.16.x
46+ } ;
47+ foreach ( var path in paths2017X86 )
3648 {
37- return true ;
49+ var parametersVc2017X86 = Registry . ClassesRoot . OpenSubKey ( path , false ) ;
50+ if ( parametersVc2017X86 == null ) continue ;
51+ var vc2017X86Version = parametersVc2017X86 . GetValue ( "Version" ) ;
52+ if ( vc2017X86Version == null ) return false ;
53+ if ( ( ( string ) vc2017X86Version ) . StartsWith ( "14" ) )
54+ {
55+ return true ;
56+ }
3857 }
3958 }
4059 return false ;
0 commit comments