public IEnumerable <CustomFilterDescription> LoadDescriptions()
 {
     try {
         return
             (System.IO.Directory.GetFiles(CustomFilterPath, "*.xml")
              .SelectMany(file => CustomFilterDescription.Load(file)));
     }
     catch (Exception) {
         return(Enumerable.Empty <CustomFilterDescription>());
     }
 }
        public static IEnumerable <CustomFilterDescription> Load(string filename)
        {
            filename = System.IO.Path.GetFullPath(filename);
            var doc = XDocument.Load(filename);

            return(doc.Root.Elements(XName.Get("filter"))
                   .Select(filter => {
                var desc = new CustomFilterDescription();
                desc.Name = filter.Attribute(XName.Get("name"))?.Value;
                desc.OutputMIMEType = filter.Attribute(XName.Get("mimetype"))?.Value;
                desc.OutputContentType = filter.Attribute(XName.Get("contenttype"))?.Value;
                desc.OutputContentExt = filter.Attribute(XName.Get("contentext"))?.Value;
                desc.Logging = ToBool(filter.Attribute(XName.Get("logging"))?.Value);
                desc.BasePath = System.IO.Path.GetDirectoryName(filename);
                desc.CommandLine = filter.Value;
                return desc;
            }).ToArray());
        }
 public CustomFilterContentSink(CustomFilterDescription desc, IContentSink sink)
 {
     this.Description = desc;
     this.Sink        = sink;
 }
 public CustomFilter(CustomFilterDescription desc)
 {
     this.Description = desc;
 }