@@ -649,10 +649,10 @@ private bool CompareKeys(RegistryView registryView, RegistryStateElement registr
649
649
return true ;
650
650
}
651
651
652
- private bool CompareValues ( object value , RegistryView registryView , RegistryStateElement registryStateElement , RegistryStateElement activeRegistryStateElement , string activeCurrentUser = null , bool activeAdministrator = true ) {
652
+ private bool CompareValues ( string value , RegistryView registryView , RegistryStateElement registryStateElement , RegistryStateElement activeRegistryStateElement , string activeCurrentUser = null , bool activeAdministrator = true ) {
653
653
// caller needs to decide what to do if value is null
654
- if ( ! ( value is string comparableValue ) ) {
655
- throw new ArgumentNullException ( "The comparableValue is null." ) ;
654
+ if ( value == null ) {
655
+ throw new ArgumentNullException ( "The value is null." ) ;
656
656
}
657
657
658
658
if ( registryStateElement == null ) {
@@ -689,26 +689,26 @@ private bool CompareValues(object value, RegistryView registryView, RegistryStat
689
689
valueKind = null ;
690
690
}
691
691
692
- string comparableRegistryStateElementValue = registryStateElement . Value ;
692
+ string registryStateElementValue = registryStateElement . Value ;
693
693
694
- if ( comparableRegistryStateElementValue != null ) {
694
+ if ( registryStateElementValue != null ) {
695
695
// if value kind is the same as current value kind
696
696
if ( valueKind == registryStateElement . ValueKind ) {
697
697
if ( activeRegistryStateElement != null ) {
698
698
// account for expanded values
699
- comparableRegistryStateElementValue = String . IsNullOrEmpty ( activeRegistryStateElement . _ValueExpanded )
700
- ? comparableRegistryStateElementValue
699
+ registryStateElementValue = String . IsNullOrEmpty ( activeRegistryStateElement . _ValueExpanded )
700
+ ? registryStateElementValue
701
701
: activeRegistryStateElement . _ValueExpanded ;
702
702
}
703
703
704
704
// check value matches current value/current expanded value
705
- if ( comparableValue . Equals ( comparableRegistryStateElementValue , StringComparison . Ordinal ) ) {
705
+ if ( value . Equals ( registryStateElementValue , StringComparison . Ordinal ) ) {
706
706
return true ;
707
707
}
708
708
709
709
// for ActiveX: check if it matches as a path
710
710
try {
711
- if ( ComparePaths ( comparableValue , comparableRegistryStateElementValue ) ) {
711
+ if ( ComparePaths ( value , registryStateElementValue ) ) {
712
712
return true ;
713
713
}
714
714
} catch {
@@ -720,20 +720,20 @@ private bool CompareValues(object value, RegistryView registryView, RegistryStat
720
720
if ( activeRegistryStateElement != null
721
721
&& activeRegistryStateElement != registryStateElement ) {
722
722
// get value before
723
- comparableRegistryStateElementValue = activeRegistryStateElement . Value ;
723
+ registryStateElementValue = activeRegistryStateElement . Value ;
724
724
725
725
// if value existed before
726
- if ( comparableRegistryStateElementValue != null ) {
726
+ if ( registryStateElementValue != null ) {
727
727
// value kind before also matters
728
728
if ( valueKind == activeRegistryStateElement . ValueKind ) {
729
729
// check value matches current value
730
- if ( comparableValue . Equals ( comparableRegistryStateElementValue , StringComparison . Ordinal ) ) {
730
+ if ( value . Equals ( registryStateElementValue , StringComparison . Ordinal ) ) {
731
731
return true ;
732
732
}
733
733
734
734
// for ActiveX: check if it matches as a path
735
735
try {
736
- if ( ComparePaths ( comparableValue , comparableRegistryStateElementValue ) ) {
736
+ if ( ComparePaths ( value , registryStateElementValue ) ) {
737
737
return true ;
738
738
}
739
739
} catch {
0 commit comments