Skip to content

Commit 30ed630

Browse files
committed
don't save _Deleted attribute if not necessary
1 parent dd4a148 commit 30ed630

1 file changed

Lines changed: 24 additions & 21 deletions

File tree

FlashpointSecurePlayer/RegistryStates.cs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -681,33 +681,37 @@ private bool CompareValues(object value, RegistryView registryView, RegistryStat
681681

682682
string comparableRegistryStateElementValue = registryStateElement.Value;
683683

684-
// if value kind is the same as current value kind
685-
if (valueKind == registryStateElement.ValueKind) {
686-
if (activeRegistryStateElement != null) {
687-
// account for expanded values
688-
comparableRegistryStateElementValue = String.IsNullOrEmpty(activeRegistryStateElement._ValueExpanded)
689-
? comparableRegistryStateElementValue
690-
: activeRegistryStateElement._ValueExpanded;
691-
}
692-
693-
// check value matches current value/current expanded value
694-
if (comparableValue.Equals(comparableRegistryStateElementValue, StringComparison.Ordinal)) {
695-
return true;
696-
}
684+
if (comparableRegistryStateElementValue != null) {
685+
// if value kind is the same as current value kind
686+
if (valueKind == registryStateElement.ValueKind) {
687+
if (activeRegistryStateElement != null) {
688+
// account for expanded values
689+
comparableRegistryStateElementValue = String.IsNullOrEmpty(activeRegistryStateElement._ValueExpanded)
690+
? comparableRegistryStateElementValue
691+
: activeRegistryStateElement._ValueExpanded;
692+
}
697693

698-
// for ActiveX: check if it matches as a path
699-
try {
700-
if (ComparePaths(comparableValue, comparableRegistryStateElementValue)) {
694+
// check value matches current value/current expanded value
695+
if (comparableValue.Equals(comparableRegistryStateElementValue, StringComparison.Ordinal)) {
701696
return true;
702697
}
703-
} catch {
704-
// fail silently
698+
699+
// for ActiveX: check if it matches as a path
700+
try {
701+
if (ComparePaths(comparableValue, comparableRegistryStateElementValue)) {
702+
return true;
703+
}
704+
} catch {
705+
// fail silently
706+
}
705707
}
706708
}
707709

708710
if (activeRegistryStateElement != null) {
711+
comparableRegistryStateElementValue = activeRegistryStateElement.Value;
712+
709713
// if value existed before
710-
if (activeRegistryStateElement.Value != null) {
714+
if (comparableRegistryStateElementValue != null) {
711715
// value kind before also matters
712716
if (valueKind == activeRegistryStateElement.ValueKind) {
713717
// get value before
@@ -1019,8 +1023,7 @@ public override void Activate(string templateName) {
10191023
Type = registryStateElement.Type,
10201024
KeyName = registryStateElement.KeyName,
10211025
ValueName = registryStateElement.ValueName,
1022-
ValueKind = valueKind,
1023-
_Deleted = String.Empty
1026+
ValueKind = valueKind
10241027
};
10251028

10261029
if (registryStateElement.Type == TYPE.KEY) {

0 commit comments

Comments
 (0)