public void TestParseFileFilters() { IList <IFileFilter> fileFilters = FileFilterHelper.ParseFileFilters("Test|*.cs|Web|*.html;*.js"); Assert.AreEqual("Test", fileFilters[0].Label); Assert.AreEqual("*.cs", fileFilters[0].Filters); Assert.AreEqual("Web", fileFilters[1].Label); Assert.AreEqual("*.html;*.js", fileFilters[1].Filters); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value == null) { return(null); } if (value is string filterStr) { return(FileFilterHelper.ParseFileFilters(filterStr)); } else if (value is IList <IFileFilter> filters) { return(filters); } else { return(base.ConvertFrom(context, culture, value)); } }