/// <summary> /// Adds the Filter to the filters for this tag. /// </summary> /// <param name="Filter">The filter to add</param> public void Add(FilterTag Filter) { switch (Filter.FilterType) { case FilterTypeEnum.Start: Content = Filter; break; case FilterTypeEnum.End: Content = Filter; break; case FilterTypeEnum.Replace: Replace = Filter; break; case FilterTypeEnum.Attribute: Attributes.Add(Filter); break; } }
/// <summary> /// ICloneable interface /// </summary> /// <returns>Clone of object</returns> public object Clone() { FilterTag result = new FilterTag(); result.Tag = Tag; result.Source = Source; result.FilterType = FilterType; result.HTML = HTML; result.Control = Control; result.Attribute = Attribute; result.IsBackup = IsBackup; result.Multiple = Multiple; return(result); }
/// <summary> /// Adds a filter to the unrendered chain of filters. /// </summary> /// <param name="key"></param> /// <param name="source"></param> private void AddFilter(string key, string source) { FilterTag Tag1 = new FilterTag(key, source); FilterTags Tag = (FilterTags)this[Tag1.Tag]; if (Tag != null) { Tag.Add(Tag1); } else { this[Tag1.Tag] = new FilterTags(Tag1); } }
/// <summary> /// True if Owner is same type as Content and if so, clears content. /// </summary> /// <param name="Owner"></param> /// <returns></returns> public bool CheckMatch(Control Owner) { if (Content == null) { return(false); } if (Content.Control.GetType().Name == Owner.GetType().Name) { Content.Control = null; Content = null; return(true); } else { return(false); } }
/// <summary> /// For filters that generate a control from a source file, this checks to /// see if the files exists first. This checks all the filters for the tag /// </summary> /// <returns>True if there is at least one filter for the tag with a valid source</returns> public bool CheckSources() { if (Content != null) { Content.Source = FilterList.CheckFile(Content.Source); if (Content.Source.Length == 0) { Content = null; } } if (Replace != null) { Replace.Source = FilterList.CheckFile(Replace.Source); if (Replace.Source.Length == 0) { Replace = null; } } return(Content != null || Replace != null || Attributes.Count > 0); }
/// <summary> /// Primary constructor, for tag with at least one filter. /// </summary> /// <param name="Filter">The filter to add.</param> public FilterTags(FilterTag Filter) { Tag = Filter.Tag; Add(Filter); }