@@ -1000,13 +1000,14 @@ private void WorkOnAnalyzeAndUpdateStatesForDotNetVersion()
1000
1000
installationMainFile = Path . Combine ( installationMainPath , $ "{ Name } .dll") ;
1001
1001
}
1002
1002
1003
- if ( ! File . Exists ( InstalledMainFilePath . GetValueAsString ( ) ) )
1003
+ var resolvedInstalledMainFilePath = InstalledMainFilePath . GetValueAsString ( ) ;
1004
+ if ( ! File . Exists ( resolvedInstalledMainFilePath ) )
1004
1005
{
1005
1006
InstallationState = ComponentInstallationState . NotInstalled ;
1006
1007
}
1007
1008
1008
1009
if ( File . Exists ( installationMainFile ) &&
1009
- File . Exists ( InstalledMainFilePath . GetValueAsString ( ) ) )
1010
+ File . Exists ( resolvedInstalledMainFilePath ) )
1010
1011
{
1011
1012
Version ? sourceVersion = null ;
1012
1013
var installationMainFileVersion = FileVersionInfo . GetVersionInfo ( installationMainFile ) ;
@@ -1017,16 +1018,23 @@ private void WorkOnAnalyzeAndUpdateStatesForDotNetVersion()
1017
1018
}
1018
1019
1019
1020
Version ? destinationVersion = null ;
1020
- var installedMainFileVersion = FileVersionInfo . GetVersionInfo ( InstalledMainFilePath . GetValueAsString ( ) ) ;
1021
+ var installedMainFileVersion = FileVersionInfo . GetVersionInfo ( resolvedInstalledMainFilePath ) ;
1021
1022
if ( installedMainFileVersion ? . FileVersion is not null )
1022
1023
{
1023
1024
destinationVersion = new Version ( installedMainFileVersion . FileVersion ) ;
1024
1025
InstalledVersion = installedMainFileVersion . FileVersion ;
1025
1026
}
1026
1027
1027
- if ( sourceVersion is not null &&
1028
- destinationVersion is not null &&
1029
- sourceVersion . IsNewerThan ( destinationVersion ) )
1028
+ if ( VersionHelper . IsDefault ( sourceVersion , destinationVersion ) )
1029
+ {
1030
+ var sourcePath = new DirectoryInfo ( installationMainFile ) . Parent ! ;
1031
+ var destinationPath = new DirectoryInfo ( resolvedInstalledMainFilePath ) . Parent ! ;
1032
+ if ( sourcePath . GetTotalFilesLength ( "*.dll" ) != destinationPath . GetTotalFilesLength ( "*.dll" ) )
1033
+ {
1034
+ InstallationState = ComponentInstallationState . InstalledWithOldVersion ;
1035
+ }
1036
+ }
1037
+ else if ( VersionHelper . IsSourceNewerThanDestination ( sourceVersion , destinationVersion ) )
1030
1038
{
1031
1039
InstallationState = ComponentInstallationState . InstalledWithOldVersion ;
1032
1040
}
@@ -1083,25 +1091,9 @@ private void WorkOnAnalyzeAndUpdateStatesForNodeJsVersion()
1083
1091
}
1084
1092
else
1085
1093
{
1086
- try
1087
- {
1088
- var isNewerThan = new Version ( sourceVersion ) . IsNewerThan ( new Version ( destinationVersion ) ) ;
1089
- InstallationState = isNewerThan
1090
- ? ComponentInstallationState . InstalledWithOldVersion
1091
- : ComponentInstallationState . Installed ;
1092
- }
1093
- catch
1094
- {
1095
- var sortedSet = new SortedSet < string > ( StringComparer . Ordinal )
1096
- {
1097
- sourceVersion ,
1098
- destinationVersion ,
1099
- } ;
1100
-
1101
- InstallationState = destinationVersion == sortedSet . First ( )
1102
- ? ComponentInstallationState . InstalledWithOldVersion
1103
- : ComponentInstallationState . Installed ;
1104
- }
1094
+ InstallationState = VersionHelper . IsSourceNewerThanDestination ( sourceVersion , destinationVersion )
1095
+ ? ComponentInstallationState . InstalledWithOldVersion
1096
+ : ComponentInstallationState . Installed ;
1105
1097
}
1106
1098
}
1107
1099
}
0 commit comments