/// <summary>Initializes a new instance of the <see cref="HostfileEntry"/> class. </summary> /// <param name="type">The entry type (e.g. <see cref="HostfileEntryType.Host"/>).</param> /// <param name="parent">The parent.</param> /// <param name="name">The name of this <see cref="HostfileEntry"/> instance.</param> /// <param name="propertyChangedCallBack">This event is fired whenever a property of this object changes.</param> protected HostfileEntry(HostfileEntryType type, IHostfileEntry parent, string name, EventHandler propertyChangedCallBack) { if (type.Equals(HostfileEntryType.NotSet) || name == null) { throw new ArgumentException("name"); } this.EntryType = type; this.Name = name; this.Parent = parent; this.PropertyChangedCallBack = propertyChangedCallBack; }
/// <summary>Initializes a new instance of the <see cref="HostfileEntry"/> class. </summary> /// <param name="type">The entry type (e.g. <see cref="HostfileEntryType.Host"/>).</param> /// <param name="parent">The parent.</param> /// <param name="name">The name of this <see cref="HostfileEntry"/> instance.</param> /// <param name="description">A description text.</param> /// <param name="childs">The childs.</param> /// <param name="propertyChangedCallBack">This event is fired whenever a property of this object changes.</param> protected HostfileEntry(HostfileEntryType type, IHostfileEntry parent, string name, string description, HostfileEntryCollection childs, EventHandler propertyChangedCallBack) { if (type.Equals(HostfileEntryType.NotSet) || string.IsNullOrEmpty(name)) { throw new ArgumentException("name"); } this.EntryType = type; this.Name = name; this.Description = description; this.Parent = parent; this.Childs = childs; this.PropertyChangedCallBack = propertyChangedCallBack; }
/// <summary>Initializes a new instance of the <see cref="ActivatableHostfileEntry"/> class.</summary> /// <param name="entryType">The entry type.</param> /// <param name="parent">The parent <see cref="IHostfileEntry"/>.</param> /// <param name="name">The name of the enntry.</param> /// <param name="description">The description text.</param> /// <param name="childs">The childs.</param> /// <param name="propertyChangedCallBack">This event is fired whenever a property of this object changes.</param> protected ActivatableHostfileEntry(HostfileEntryType entryType, IHostfileEntry parent, string name, string description, HostfileEntryCollection childs, EventHandler propertyChangedCallBack) : base(entryType, parent, name, description, childs, propertyChangedCallBack) { this.IsActivatable = true; }
/// <summary>Returns the <see cref="IHostfileEntry"/> which matches the specified <paramref name="entryType"/> and <paramref name="name"/>.</summary> /// <param name="entryType">The entry type of the <see cref="IHostfileEntry"/>.</param> /// <param name="name">The name of the <see cref="IHostfileEntry"/>.</param> /// <returns>The <see cref="IHostfileEntry"/> which matches the specified <paramref name="entryType"/> and <paramref name="name"/>; null if the <see cref="IHostfileEntry"/> was not found.</returns> public IHostfileEntry GetElementBy(HostfileEntryType entryType, string name) { return(this.FirstOrDefault(item => item.EntryType.Equals(entryType) && item.Name.Equals(name, StringComparison.OrdinalIgnoreCase))); }