internal void Remove(TEscherOPTRecord Opt, bool AlsoRemoveShapeId) { FillNotLoaded(); if (AlsoRemoveShapeId) { OptsByShapeId.Remove(Opt.ShapeId()); } if (Opt == null || String.IsNullOrEmpty(Opt.ShapeName)) { return; } TLinkedOpts FirstOpt; if (!OptsByName.TryGetValue(Opt.ShapeName, out FirstOpt)) { return; } TLinkedOpts current = FirstOpt; TLinkedOpts previous = null; while (current != null) { if (current.Opt == Opt) { break; } previous = current; current = current.Next; } if (current == null) { return; } if (previous != null) { previous.Next = current.Next; } else { TLinkedOpts next = current.Next; OptsByName.Remove(Opt.ShapeName); if (next != null) { OptsByName.Add(Opt.ShapeName, next); } } }
internal void AddShapeName(TEscherOPTRecord Opt) { if (string.IsNullOrEmpty(Opt.ShapeName)) { return; } TLinkedOpts NeOpt = new TLinkedOpts(); NeOpt.Opt = Opt; TLinkedOpts FirstOpt; if (OptsByName.TryGetValue(Opt.ShapeName, out FirstOpt)) { NeOpt.Next = FirstOpt.Next; FirstOpt.Next = NeOpt; } else { NeOpt.Next = null; OptsByName.Add(Opt.ShapeName, NeOpt); } }