void UpdateOptions(HexEditorOptions oldParent) { if (oldParent != null) { for (int i = 0; i < oldParent.weakChildren.Count; i++) { if (oldParent.weakChildren[i].Target == this) { oldParent.weakChildren.RemoveAt(i); break; } } } if (parent != null) { parent.weakChildren.Add(new WeakReference(this)); } if (parent != null || oldParent != null) { foreach (var o in SupportedOptions) { if (dict.ContainsKey(o.Name)) { continue; } var oldValue = oldParent == null ? o.DefaultValue : oldParent.GetValueOrDefault(o.Name); var newValue = parent == null ? o.DefaultValue : parent.GetValueOrDefault(o.Name); if (!Equals(oldValue, newValue)) { OnChanged(o.Name); } } } }
public HexEditorOptions(HexEditorOptionsFactoryServiceImpl service, HexEditorOptions parent, VSUTIL.IPropertyOwner scope) { this.service = service; this.parent = parent; dict = new Dictionary <string, object>(StringComparer.Ordinal); weakChildren = new List <WeakReference>(); this.scope = scope; UpdateOptions(null); }
HexEditorOptionsFactoryServiceImpl([ImportMany] IEnumerable <HexEditorOptionDefinition> editorOptionDefinitions) { this.editorOptionDefinitions = new Dictionary <string, HexEditorOptionDefinition>(); foreach (var o in editorOptionDefinitions) { Debug.Assert(!this.editorOptionDefinitions.ContainsKey(o.Name)); this.editorOptionDefinitions[o.Name] = o; } HexGlobalOptions = new HexEditorOptions(this, null, null); }