public override BuildTopicTocInfo Find(string name, bool recursive) { if (String.Equals(name, this.Name, StringComparison.OrdinalIgnoreCase)) { return(this); } if (_listTopics != null && _listTopics.Count != 0) { BuildTopicTocInfo foundTopic = this[name]; if (foundTopic != null) { return(foundTopic); } if (recursive) { for (int i = 0; i < _listTopics.Count; i++) { foundTopic = _listTopics[i].Find(name, recursive); if (foundTopic != null) { break; } } } return(foundTopic); } return(null); }
public BuildTopicTocInfo(BuildTopicTocInfo source) : base(source) { _source = source._source; _container = source._container; _parent = source._parent; _listTopics = source._listTopics; }
public override bool Equals(object obj) { BuildTopicTocInfo other = obj as BuildTopicTocInfo; if (other == null) { return(false); } return(this.Equals(other)); }
public BuildTopicTocInfo(string name, string source, BuildTopicTocInfo parent) : base(name) { if (String.IsNullOrEmpty(source)) { source = Guid.NewGuid().ToString(); } _source = source; _parent = parent; }
public void Add(BuildTopicTocInfo item) { if (item == null) { return; } if (_listTopics == null) { _listTopics = new BuildKeyedList <BuildTopicTocInfo>(); } _listTopics.Add(item); }
public void Insert(int index, BuildTopicTocInfo item) { if (item == null) { return; } if (_listTopics == null) { _listTopics = new BuildKeyedList <BuildTopicTocInfo>(); } _listTopics.Insert(index, item); }
public int IndexOf(BuildTopicTocInfo item) { if (item == null) { return(-1); } if (_listTopics != null && _listTopics.Count != 0) { return(_listTopics.IndexOf(item)); } return(-1); }
public override BuildTocInfo Clone() { BuildTopicTocInfo item = new BuildTopicTocInfo(this); if (this.Name != null) { item.Name = String.Copy(this.Name); } if (_source != null) { item._source = String.Copy(_source); } return(item); }
public void Add(BuildTopicTocInfo item) { if (item == null || String.IsNullOrEmpty(item.Name)) { return; } if (_relatedTopics.Contains(item.Name)) { _relatedTopics.Insert(_relatedTopics.Dictionary[item.Name], item); } else { _relatedTopics.Add(item); } }
public BuildTopicTocInfo this[string itemName] { get { if (String.IsNullOrEmpty(itemName)) { return(null); } BuildTopicTocInfo tocInfo = null; if (_relatedTopics != null && _relatedTopics.Count != 0) { tocInfo = _relatedTopics[itemName]; if (tocInfo != null) { return(tocInfo); } } if (_listItems == null || _listItems.Count == 0) { return(null); } for (int i = 0; i < _listItems.Count; i++) { tocInfo = _listItems[i][itemName]; if (tocInfo != null) { break; } } if (tocInfo != null) { return(tocInfo); } for (int i = 0; i < _listItems.Count; i++) { tocInfo = _listItems[i].Find(itemName, true); if (tocInfo != null) { break; } } return(tocInfo); } }
public void Remove(BuildTopicTocInfo item) { if (item == null) { return; } if (_listTopics == null || _listTopics.Count == 0) { return; } if (!_listTopics.Remove(item)) { BuildTopicTocInfo parent = item.Parent; if (parent != null) { parent.Remove(item); } } }
public void Replace(BuildTopicTocInfo itemOut, BuildTopicTocInfo itemIn) { if (itemIn == null || itemOut == null || _listTopics == null) { return; } int index = this.IndexOf(itemOut); if (index < 0) { BuildTopicTocInfo itemParent = itemOut.Parent; if (itemParent != null) { itemParent.Replace(itemOut, itemIn); } return; } _listTopics.RemoveAt(index); _listTopics.Insert(index, itemIn); }
public void Replace(BuildTopicTocInfo itemOut, BuildGroupTocInfo groupTocInfo) { if (itemOut == null || groupTocInfo == null || groupTocInfo.Count == 0 || _listTopics == null) { return; } int index = this.IndexOf(itemOut); if (index < 0) { BuildTopicTocInfo itemParent = itemOut.Parent; if (itemParent != null) { itemParent.Replace(itemOut, groupTocInfo); } return; } _listTopics.RemoveAt(index); _listTopics.Insert(index, groupTocInfo.Items); }
public bool Remove(BuildTopicTocInfo item) { return(_relatedTopics.Remove(item)); }
public virtual int IndexOf(BuildTopicTocInfo item) { return(-1); }
public virtual void Remove(BuildTopicTocInfo item) { }
public virtual void Replace(BuildTopicTocInfo itemOut, BuildGroupTocInfo groupTocInfo) { }
public virtual void Replace(BuildTopicTocInfo itemOut, IList <BuildTopicTocInfo> items) { }
public virtual void Replace(BuildTopicTocInfo itemOut, BuildTopicTocInfo itemIn) { }
public virtual void Insert(int index, BuildTopicTocInfo item) { }
public virtual void Add(BuildTopicTocInfo item) { }
/// <summary> /// This reads and sets its state or attributes stored in a <c>XML</c> format /// with the given reader. /// </summary> /// <param name="reader"> /// The reader with which the <c>XML</c> attributes of this object are accessed. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void ReadXml(XmlReader reader) { BuildExceptions.NotNull(reader, "reader"); Debug.Assert(reader.NodeType == XmlNodeType.Element); if (reader.NodeType != XmlNodeType.Element) { return; } if (!String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { Debug.Assert(false, String.Format( "The element name '{0}' does not match the expected '{1}'.", reader.Name, TagName)); return; } string topicId = reader.GetAttribute("id"); string topicFile = reader.GetAttribute("file"); if (!String.IsNullOrEmpty(topicId) && !String.IsNullOrEmpty(topicFile)) { this.Name = topicId; _source = topicFile; _container = reader.GetAttribute("project"); } else { return; } if (reader.IsEmptyElement) { return; } XmlNodeType nodeType = XmlNodeType.None; while (reader.Read()) { nodeType = reader.NodeType; if (nodeType == XmlNodeType.Element && String.Equals(reader.Name, "topic", StringComparison.OrdinalIgnoreCase)) { BuildTopicTocInfo topic = new BuildTopicTocInfo( Guid.NewGuid().ToString(), String.Empty, this); topic.ReadXml(reader); this.Add(topic); } else if (nodeType == XmlNodeType.EndElement) { if (String.Equals(reader.Name, BuildTopicTocInfo.TagName, StringComparison.OrdinalIgnoreCase)) { break; } } } }