コード例 #1
0
ファイル: HexEditorOptions.cs プロジェクト: azureidea/dnSpy-1
        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);
                    }
                }
            }
        }
コード例 #2
0
ファイル: HexEditorOptions.cs プロジェクト: azureidea/dnSpy-1
 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);
 }
コード例 #3
0
 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);
 }