Skip to content

Commit 6cfa6f7

Browse files
committed
use string for value instead of object
1 parent adfaf1c commit 6cfa6f7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

FlashpointSecurePlayer/RegistryStates.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,10 @@ private bool CompareKeys(RegistryView registryView, RegistryStateElement registr
649649
return true;
650650
}
651651

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) {
653653
// 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.");
656656
}
657657

658658
if (registryStateElement == null) {
@@ -689,26 +689,26 @@ private bool CompareValues(object value, RegistryView registryView, RegistryStat
689689
valueKind = null;
690690
}
691691

692-
string comparableRegistryStateElementValue = registryStateElement.Value;
692+
string registryStateElementValue = registryStateElement.Value;
693693

694-
if (comparableRegistryStateElementValue != null) {
694+
if (registryStateElementValue != null) {
695695
// if value kind is the same as current value kind
696696
if (valueKind == registryStateElement.ValueKind) {
697697
if (activeRegistryStateElement != null) {
698698
// account for expanded values
699-
comparableRegistryStateElementValue = String.IsNullOrEmpty(activeRegistryStateElement._ValueExpanded)
700-
? comparableRegistryStateElementValue
699+
registryStateElementValue = String.IsNullOrEmpty(activeRegistryStateElement._ValueExpanded)
700+
? registryStateElementValue
701701
: activeRegistryStateElement._ValueExpanded;
702702
}
703703

704704
// check value matches current value/current expanded value
705-
if (comparableValue.Equals(comparableRegistryStateElementValue, StringComparison.Ordinal)) {
705+
if (value.Equals(registryStateElementValue, StringComparison.Ordinal)) {
706706
return true;
707707
}
708708

709709
// for ActiveX: check if it matches as a path
710710
try {
711-
if (ComparePaths(comparableValue, comparableRegistryStateElementValue)) {
711+
if (ComparePaths(value, registryStateElementValue)) {
712712
return true;
713713
}
714714
} catch {
@@ -720,20 +720,20 @@ private bool CompareValues(object value, RegistryView registryView, RegistryStat
720720
if (activeRegistryStateElement != null
721721
&& activeRegistryStateElement != registryStateElement) {
722722
// get value before
723-
comparableRegistryStateElementValue = activeRegistryStateElement.Value;
723+
registryStateElementValue = activeRegistryStateElement.Value;
724724

725725
// if value existed before
726-
if (comparableRegistryStateElementValue != null) {
726+
if (registryStateElementValue != null) {
727727
// value kind before also matters
728728
if (valueKind == activeRegistryStateElement.ValueKind) {
729729
// check value matches current value
730-
if (comparableValue.Equals(comparableRegistryStateElementValue, StringComparison.Ordinal)) {
730+
if (value.Equals(registryStateElementValue, StringComparison.Ordinal)) {
731731
return true;
732732
}
733733

734734
// for ActiveX: check if it matches as a path
735735
try {
736-
if (ComparePaths(comparableValue, comparableRegistryStateElementValue)) {
736+
if (ComparePaths(value, registryStateElementValue)) {
737737
return true;
738738
}
739739
} catch {

0 commit comments

Comments
 (0)